当前位置:网站首页>Yyds dry goods inventory leetcode question set 751 - 760
Yyds dry goods inventory leetcode question set 751 - 760
2022-07-06 19:25:00 【Brother daze who loves learning】
LeetCode Exercise set
Some questions may be skipped directly , Brush before tidying up leetcode
752. Open the turntable lock
You have a turntable lock with four round pulleys . Every wheel has 10 A digital : ‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’ . Each wheel can rotate freely : For example, put ‘9’ Turn into ‘0’,‘0’ Turn into ‘9’ . Each rotation can only rotate one digit of a wheel .
The initial number of locks is ‘0000’ , A string representing the number of four dials .
list deadends Contains a set of death figures , Once the number of dials is the same as any element in the list , This lock will be permanently locked , Can't be rotated again .
character string target Represents a number that can be unlocked , You need to give the minimum number of rotations , If you can't unlock it anyway , return -1.
Tips :
Death list deadends The length range of is [1, 500].
Target number target Not in deadends In .
Every deadends and target The number of strings in will be in 10,000 A possible situation ‘0000’ To ‘9999’ Produced in .
753. Crack the safe
There's a safe that needs a password to open . The password is n digit , Every bit of the code is k Bit sequence 0, 1, …, k-1 One of them .
You can enter the password as you like , The safe will automatically remember the last n An input , If the match , You can open the safe .
for instance , Suppose the password is “345”, You can type “012345” To open it , It's just that you typed in 6 Characters .
Please return the shortest string that can open the safe .
Example 1:
Input : n = 1, k = 2
Output : “01”
explain : "10" You can also open the safe .
Example 2:
Input : n = 2, k = 2
Output : “00110”
explain : “01100”, “10011”, “11001” You can open the safe, too .
Tips :
n The range is [1, 4].
k The range is [1, 10].
k^n The most likely is 4096.
PS:
Should say no , Baidu translation is better than this
754. The number at the end of the line
On an infinite number axis , You are standing 0 The location of . End at target The location of .
Every time you choose to move left or right . The first n Secondary mobility ( from 1 Start ), You can go n Step .
Return to the minimum number of moves required to reach the destination .
Example 1:
Input : target = 3
Output : 2
explain :
First move , from 0 To 1 .
Second move , from 1 To 3 .
Example 2:
Input : target = 2
Output : 3
explain :
First move , from 0 To 1 .
Second move , from 1 To -1 .
The third move , from -1 To 2 .
Be careful :
target Is in [-10^9, 10^9] Nonzero integers in the range .
756. Pyramid transformation matrix
Now? , We use some squares to build a pyramid . Each square is represented by a string containing only one letter .
The stacking rules of using triples to represent pyramids are as follows :
For three tuples (A, B, C) ,“C” For the top box , square “A”、“B” As squares “C” The left of the next floor 、 Right sub block . If and only if (A, B, C) Are allowed triples , Before we can pile it up .
At the beginning , The base of a given pyramid bottom, Use a string to represent . A list of allowed triples allowed, Each triplet has a length of 3 String representation of .
If it can be piled from the base to the spire, it will return true, Otherwise return to false.
Be careful :
bottom The length range of is [2, 8].
allowed The length range of is [0, 200].
The marking letter range of the box is {‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’}.
757. Set the intersection size to at least 2
An integer interval [a, b] ( a < b ) It's about starting from a To b All consecutive integers of , Include a and b.
Give you a set of integer intervals intervals, Please find a minimum set S, bring S Elements and intervals in intervals Every integer interval in has at least 2 Elements intersect .
Output this minimal set S Size .
Example 1:
Input : intervals = [[1, 3], [1, 4], [2, 5], [3, 5]]
Output : 3
explain :
Consider the set S = {2, 3, 4}. S And intervals All four intervals in have at least 2 Intersecting elements .
And this is S In the smallest case , So we export 3.
Example 2:
Input : intervals = [[1, 2], [2, 3], [2, 4], [4, 5]]
Output : 5
explain :
The smallest set S = {1, 2, 3, 4, 5}.
Be careful :
intervals The length range of is [1, 3000].
intervals[i] The length is 2, Left respectively 、 Right border .
intervals[i][j] The value of is [0, 10^8] Range of integers .
边栏推荐
- Documents to be used in IC design process
- CCNP Part 11 BGP (III) (essence)
- Dark horse -- redis
- short i =1; i=i+1与short i=1; i+=1的区别
- IC设计流程中需要使用到的文件
- ROS自定义消息发布订阅示例
- Druid database connection pool details
- ModuleNotFoundError: No module named ‘PIL‘解决方法
- 凤凰架构2——访问远程服务
- Actf 2022 came to a successful conclusion, and 0ops team won the second consecutive championship!!
猜你喜欢

史上超级详细,想找工作的你还不看这份资料就晚了

10 schemes to ensure interface data security

零基础入门PolarDB-X:搭建高可用系统并联动数据大屏

快速幂模板求逆元,逆元的作用以及例题【第20届上海大学程序设计联赛夏季赛】排列计数

倒计时2天|腾讯云消息队列数据接入平台(Data Import Platform)直播预告

Intelligent supply chain management system solution for hardware and electromechanical industry: digital intelligent supply chain "creates new blood" for traditional industries

Abstract classes and abstract methods

思维导图+源代码+笔记+项目,字节跳动+京东+360+网易面试题整理

第五期个人能力认证考核通过名单公布

Actf 2022 came to a successful conclusion, and 0ops team won the second consecutive championship!!
随机推荐
A full set of teaching materials, real questions of Android interview of 7 major manufacturers including Alibaba Kwai pinduoduo
Documents to be used in IC design process
利用 clip-path 绘制不规则的图形
R language ggplot2 visual time series histogram: visual time series histogram through two-color gradient color matching color theme
思維導圖+源代碼+筆記+項目,字節跳動+京東+360+網易面試題整理
R语言使用order函数对dataframe数据进行排序、基于单个字段(变量)进行降序排序(DESCENDING)
中缀表达式转后缀表达式详细思路及代码实现
凤凰架构2——访问远程服务
Pytorch common loss function
AutoCAD - what is the default lineweight for centerline drawing and CAD? Can I modify it?
应用使用Druid连接池经常性断链问题分析
map的使用(列表的数据赋值到表单,json逗号隔开显示赋值)
史上超级详细,想找工作的你还不看这份资料就晚了
Use of deg2rad and rad2deg functions in MATLAB
五金机电行业供应商智慧管理平台解决方案:优化供应链管理,带动企业业绩增长
Precautions for binding shortcut keys of QPushButton
Elastic search indexes are often deleted [closed] - elastic search indexes gets deleted frequently [closed]
Interface test tool - postman
An error occurs when installing MySQL: could not create or access the registry key needed for the
ROS自定义消息发布订阅示例