- 博客(79)
- 收藏
- 关注
转载 [LeetCode] 559. Maximum Depth of N-ary Tree
EasyGiven a n-ary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.For example, given a3-aryt...
2019-09-26 13:47:00
286
转载 [LeetCode] 1122. Relative Sort Array
EasyGiven two arraysarr1andarr2, the elements ofarr2are distinct, and all elements inarr2are also inarr1.Sort the elements ofarr1such that the relative ordering of items inarr1are...
2019-09-26 10:18:00
278
转载 [LeetCode] 965. Univalued Binary Tree
EasyA binary tree isunivaluedif every node in the tree has the same value.Returntrueif and only if the given tree is univalued.Example 1:Input: [1,1,1,1,1,null,1]Output: true...
2019-09-24 16:42:00
262
转载 [LeetCode] 811. Subdomain Visit Count
EasyA website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com", and at the lowest level, "discuss.le...
2019-09-24 16:17:00
201
转载 [LeetCode] 509. Fibonacci Number
EasyTheFibonacci numbers, commonly denotedF(n)form a sequence, called theFibonacci sequence, such that each number is the sum of the two preceding ones, starting from0and1. That is,F(0...
2019-09-24 11:22:00
135
转载 [LeetCode] 1200. Minimum Absolute Difference
EasyGiven anarrayofdistinctintegersarr, find all pairs of elements with the minimum absolute difference of any two elements.Return a list of pairs in ascending order(with respect to pai...
2019-09-24 10:41:00
206
转载 [LeetCode] 590. N-ary Tree Postorder Traversal
EasyGiven an n-ary tree, return thepostordertraversal of its nodes' values.For example, given a3-arytree:Return its postorder traversal as:[5,6,3,2,4,1].Note:Recursive s...
2019-09-19 13:52:00
134
转载 input单选框——自定义样式
方法一:给input添加-webkit-appearance: none;隐藏默认样式。然后添加自己的样式就好了。例如:.radioBox input{ -webkit-appearance: none; width: 20px; height: 20px; padding: 0; background-c...
2019-09-17 17:16:00
1127
转载 input单选框——获取选中值和设置选中值
javascript:input单选框CheckBox对象参考:https://www.w3school.com.cn/jsref/dom_obj_checkbox.asp获取选中值:判断各选项是否选中:if(document.getElementById("reserve_yes").checked){ reserve=yes;}else if(...
2019-09-16 15:27:00
1818
转载 [LeetCode] 933. Number of Recent Calls
EasyWrite a classRecentCounterto count recent requests.It has only one method:ping(int t), where t represents some time in milliseconds.Return the number ofpings that have been made fro...
2019-09-11 13:59:00
125
转载 [LeetCode] 1051. Height Checker
EasyStudents are asked to stand in non-decreasing order of heights for an annual photo.Return the minimum number of students not standing in the right positions. (This is the number of stude...
2019-09-09 14:03:00
99
转载 [LeetCode] 589. N-ary Tree Preorder Traversal
EasyGiven an n-ary tree, return thepreordertraversal of its nodes' values.For example, given a3-arytree:Return its preorder traversal as:[1,3,5,6,2,4].Note:Recursive sol...
2019-09-06 17:25:00
106
转载 jquery—鼠标移入移出动作与元素的显示和隐藏
jquery中的鼠标移入和移除动作控制元素的显示或隐藏。效果:方法:使用jquery中的鼠标移入和移除动作:移入:onmouseover移出:onmouseouthtml<!-- 最外层div添加了两个动作,以及动作触发的函数 --><div class='atlas' onmouseover='overShow(this)' ...
2019-09-05 16:53:00
822
转载 [LeetCode] 929. Unique Email Addresses
EasyEvery email consists of a local name and a domain name, separated by the @ sign.For example, inalice@leetcode.com,aliceis the local name, andleetcode.comis the domain name.Besides ...
2019-09-04 17:21:00
231
转载 [LeetCode] 1160. Find Words That Can Be Formed by Characters
EasyYou are given an array of stringswordsand a stringchars.A string isgoodifit can be formed bycharacters fromchars(each charactercan only be used once).Return the sum of lengths...
2019-09-03 18:03:00
134
转载 [LeetCode] 561. Array Partition I
EasyGiven an array of2nintegers, your task is to group these integers intonpairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as la...
2019-09-02 15:15:00
102
转载 [LeetCode] 942. DI String Match
EasyGiven a stringSthatonlycontains "I" (increase) or "D" (decrease), letN = S.length.ReturnanypermutationAof[0, 1, ..., N]such that for alli = 0,..., N-1:IfS[i] == "I", the...
2019-09-02 14:40:00
135
转载 [LeetCode] 852. Peak Index in a Mountain Array
EasyLet's call an arrayAamountainif the following properties hold:A.length >= 3There exists some0 < i< A.length - 1such thatA[0] < A[1] < ... A[i-1] < A[i] > ...
2019-09-02 13:48:00
161
转载 [LeetCode] 461. Hamming Distance
EasyTheHamming distancebetween two integers is the number of positions at which the corresponding bits are different.Given two integersxandy, calculate the Hamming distance.Note:0 ≤x,...
2019-08-29 17:37:00
100
转载 [LeetCode] 617. Merge Two Binary Trees
EasyGiven two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You need to merge them into a new ...
2019-08-29 17:07:00
118
转载 [Leetcode]728. Self Dividing Numbers
EasyAself-dividing numberis a number that is divisible by every digit it contains.For example, 128 is a self-dividing number because128 % 1 == 0,128 % 2 == 0, and128 % 8 == 0.Also, a s...
2019-08-28 17:20:00
99
转载 [Leetcode]977. Squares of a Sorted Array
EasyGiven an array of integersAsorted in non-decreasing order,return an array of the squares of each number,also in sorted non-decreasing order.Example 1:Input: [-4,-1,0,3,10]Out...
2019-08-28 16:49:00
123
转载 [Leetcode]961. N-Repeated Element in Size 2N Array
EasyIn a arrayAof size2N, there areN+1unique elements, and exactly one of these elements is repeated N times.Return the element repeatedNtimes.Example 1:Input: [1,2,3,3]Outp...
2019-08-27 22:04:00
100
转载 [Leetcode]657. Robot Return to Origin
EasyThere is a robot starting at position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, judge if this robotends up at (0, 0)after it completes its moves.The move sequenc...
2019-08-27 21:43:00
77
转载 win10安装配置face_recognition—Python
在github上下载了人脸识别算法face_recognition的源码,但在win10上运行有问题,通过查询资料,终于成功了。下面是在win10系统中对face_recognition的下载和配置步骤的总结。参考:https://github.com/ageitgey/face_recognition/issues/1751.首先,你的电脑上需要有一下几个东西:...
2019-08-27 16:04:00
292
转载 [LeetCode] 832. Flipping an Image
Given a binary matrixA, we want to flip the image horizontally, then invert it, and return the resulting image.To flip an image horizontally means that each row of the image is reversed. For ...
2019-07-26 10:22:00
83
转载 [LeetCode] 804. Unique Morse Code Words
International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows:"a"maps to".-","b"maps to"-...","c"maps to"-.-.", and so on....
2019-07-24 11:32:00
83
转载 [LeetCode] 1021. Remove Outermost Parentheses
A valid parentheses string is either empty(""),"(" + A + ")", orA + B, whereAandBare valid parentheses strings, and+represents string concatenation. For example,"","()","(())()", and...
2019-07-23 15:08:00
82
转载 [LeetCode] 771. Jewels and Stones
You're given stringsJrepresenting the types of stones that are jewels, andSrepresenting the stones you have. Each character inSis a type of stone you have. You want to know how many of th...
2019-07-19 13:53:00
71
转载 [LeetCode] 129. Sum Root to Leaf Numbers
Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which represents the number123.Find the...
2019-07-19 11:33:00
57
转载 [LeetCode] 121. Best Time to Buy and Sell Stock
Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the st...
2019-06-26 11:20:00
61
转载 [LeetCode] 116. Populating Next Right Pointers in Each Node
You are given aperfect binary treewhereall leaves are on the same level, and every parent has two children. The binary tree has the following definition:struct Node { int val; Node *le...
2019-06-12 11:59:00
60
转载 [LeetCode] 113. Path Sum II
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.Note:A leaf is a node with no children.Example:Given the below binary tree andsum = 2...
2019-06-07 14:15:00
83
转载 jQuery实现图片添加及预览
效果如下:方法:添加图片使用了<input>标签,将标签的type设置为file就可以点击打开文件夹添加文件了。<input id="atlas_photo" type="file">当前在页面表现为一个输入栏如果不想要输入栏可以将其隐藏:将其display设置为none,并使用图片元素代替点击。相当于给点击选择文件换一种展现形...
2019-06-05 20:00:00
1214
转载 H5移动端适配——解决移动端必须手动调整以适配的问题
问题:H5网页在移动端浏览器上打开时过大,需要双击或者手动调整才能适配屏幕。效果如下:问题的根本原因是:写网页的时候尺寸设置过大(・ัω・ั)直接按照UI给的设计图上的尺寸设置后,整个页面变成了它本应该大小的2倍大。原因在于一般UI给的单位是物理像素,而css中的像素是一个抽象值,css中的1px和设备的1物理像素有着一定的对应关系。参考:http://www.m...
2019-06-04 17:25:00
438
转载 [LeetCode] 110. Balanced Binary Tree
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as:a binary tree in which the depth of the two subtrees ofeverynode neve...
2019-06-04 16:49:00
65
转载 [LeetCode] 106. Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.For example, giveninorder =[9,3,15,20,7]postorder ...
2019-06-03 18:21:00
64
转载 HTML+jQuery 点击滑动到页面的指定位置
实现效果效果1:点击标签跳转到页面的指定位置效果2:当页面滑动到相应位置时导航栏样式改变效果如下:方法:使用scrollTop进行定位和跳转。首先,在HTML中给跳转到的结点设置id<div class="title" id="history">History</div><div class="hist...
2019-05-30 18:24:00
631
转载 CSS—图片水平垂直居中
图片居中方法1.将放置图片的容器的布局改为display: table-cell;text-align: center;可以使容器内的元素均居中显示。效果如下:如果需要水平垂直居中,添加display: table-cell;text-align: center;vertical-align: middle;效果如下:...
2019-05-30 17:34:00
82
转载 CSS—将文字和图片重叠,元素重叠效果
将文字或者其他元素和图片重叠1.上层为块级元素,效果图:设置上边元素的定位为position:relative再根据相对图片的位置调整right、left、top和bottom值2.当上层元素是文字时,效果图:可设置文本框的区域大小,然后将图片设置为背景width: 100%;height: 350px;backgrou...
2019-05-30 17:12:00
4237
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人