- 博客(34)
- 收藏
- 关注
转载 601. Human Traffic of Stadium【leetcode】
取三个以上连续的连续的行使得他们的人数大于100X city built a new stadium, each day many people visit it and the stats are saved as these columns:id,date,peoplePlease write a query to display the records which h...
2017-10-10 16:23:00
238
转载 184. Department Highest Salary【leetcode】sql,join on
184. Department Highest SalaryTheEmployeetable holds all employees. Every employee has an Id, a salary, and there is also a column for the department Id.+----+-------+--------+-------------...
2017-08-27 21:42:00
131
转载 181. Employees Earning More Than Their Managers【leetcode】,sql,inner join ,where
181. Employees Earning More Than Their ManagersTheEmployeetable holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id.+----...
2017-08-27 21:05:00
121
转载 178. Rank Scores【leetcode】,sql
Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ranking. Note that after a tie, the next ranking number should be the next consecutive integer va...
2017-08-27 20:32:00
130
转载 177. Nth Highest Salary【leetcode】,第n高数值,sql,limit,offset
Write a SQL query to get thenthhighest salary from theEmployeetable.+----+--------+| Id | Salary |+----+--------+| 1 | 100 || 2 | 200 || 3 | 300 |+----+--------+...
2017-08-27 20:06:00
82
转载 176. Second Highest Salary【取表中第二高的值】,sql,limit,offset
Write a SQL query to get the second highest salary from theEmployeetable.+----+--------+| Id | Salary |+----+--------+| 1 | 100 || 2 | 200 || 3 | 300 |+----+--------+...
2017-08-27 20:02:00
134
转载 118. Pascal's Triangle【LeetCode】,java,算法,杨辉三角
118. Pascal's TriangleGivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]...
2017-08-21 00:08:00
93
转载 204. Count Primes【leetcode】java,算法,质数
204. Count PrimesCount the number of prime numbers less than a non-negative number,n.题意:计算小于非负数的质数数。 1 public class Solution { 2 public int countPrimes(int n) { 3 //能够在这里...
2017-08-17 22:40:00
90
转载 202. Happy Number【leetcode】java,hashSet,算法
202. Happy NumberWrite an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the num...
2017-08-17 22:03:00
114
转载 41. First Missing Positive【leetcode】寻找第一个丢失的整数,java,算法
41. First Missing PositiveGiven an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should run inO(...
2017-08-14 23:58:00
124
转载 26. Remove Duplicates from Sorted Array【leetcode】,数组,array,java,算法
26. Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a...
2017-08-14 21:48:00
88
转载 11. Container With Most Water【leetcode】,java算法,数组,求最大水池注水量
11. Container With Most WaterGivennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of linei...
2017-08-14 20:11:00
187
转载 4. Median of Two Sorted Arrays【leetcode】java,算法,中间值
4. Median of Two Sorted ArraysThere are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(lo...
2017-08-13 19:37:00
94
转载 3. Longest Substring Without Repeating Characters【leetcode】java,算法,Substring实现,子串,HashMap...
3. Longest Substring Without Repeating CharactersGiven a string, find the length of thelongest substringwithout repeating characters.Examples:Given"abcabcbb", the answer is"abc", which ...
2017-08-13 18:14:00
88
转载 88. Merge Sorted Array【leetcode】算法,java将两个有序数组合并到一个数组中
88. Merge Sorted ArrayGiven two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that is greater or equa...
2017-08-13 15:28:00
109
转载 70. Climbing Stairs【leetcode】递归,动态规划,java,算法
You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note:Givennwill be a pos...
2017-08-12 21:00:00
140
转载 136. Single Number【LeetCode】异或运算符,算法,java
Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using ex...
2017-08-12 16:20:00
90
转载 605. Can Place Flowers种花问题【leetcode】
Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for water and both would die....
2017-08-12 15:21:00
90
转载 175. Combine Two Tables【LeetCode】-LEFT JON 和RIGHT JOIN,两张表关联查询-java -sql入门
Table:Person+-------------+---------+| Column Name | Type |+-------------+---------+| PersonId | int || FirstName | varchar || LastName | varchar |+-------------+---...
2017-08-12 12:21:00
134
转载 67. Add Binary【LeetCode】
67. Add BinaryGiven two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100". 1 public class Solution { 2 public String addBinary(String a...
2017-08-11 00:34:00
112
转载 66. Plus One【leetcode】
Given a non-negative integer represented as anon-emptyarray of digits, plus one to the integer.You may assume the integer do not contain any leading zero, except the number 0 itself.The dig...
2017-08-10 23:31:00
89
转载 58. Length of Last Word【leetcode】
Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word does not exist, return 0.Note:A word i...
2017-08-10 22:09:00
129
转载 53. Maximum Subarray【leetcode】
53. Maximum Subarray【leetcode】Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[-2,1,-3,4,-1,2,1,-5,4],the ...
2017-08-10 10:39:00
63
转载 28.Implement strStr()【leetcod】
Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack 1 public class Solution { 2 public int strStr(String haysta...
2017-08-10 01:47:00
64
转载 35. Search Insert Position【leetcode】
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the arr...
2017-08-10 00:33:00
69
转载 27. Remove Element【leetcode】
27. Remove Element【leetcode】Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this i...
2017-08-10 00:13:00
58
转载 20. Valid Parentheses【leetcode】
20. Valid ParenthesesGiven a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct order,"()"a...
2017-08-08 23:08:00
57
转载 14. Longest Common Prefix【leetcode】
14. Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.寻找一个数组中最长的公共前缀例如["baaa","caaabbb","aaaa"]输出“aaa”结题思路:判断非空的情况在进行计算取第一个字...
2017-08-08 21:35:00
90
转载 Java的String中的subString()方法
public String substring(int beginIndex, int endIndex)第一个int为开始的索引,对应String数字中的开始位置,第二个是截止的索引位置,对应String中的结束位置1、取得的字符串长度为:endIndex - beginIndex;2、从beginIndex开始取,到endIndex结束,从0开始数,其中不包括endI...
2017-08-08 21:00:00
145
转载 charAt()的功能
<script type="text/javascript">var str="Hello world!"document.write(str.charAt(1))</script>获取某位字符串的字符(0-length-1)转载于:https://www.cnblogs.com/haoHaoStudyShare/p/7308784.htm...
2017-08-08 20:20:00
227
转载 "=="和equals方法究竟有什么区别?
(单独把一个东西说清楚,然后再说清楚另一个,这样,它们的区别自然就出来了,混在一起说,则很难说清楚)==操作符专门用来比较两个变量的值是否相等,也就是用于比较变量所对应的内存中所存储的数值是否相同,要比较两个基本类型的数据或两个引用变量是否相等,只能用==操作符。如果一个变量指向的数据是对象类型的,那么,这时候涉及了两块内存,对象本身占用一块内存(堆内存),变量也占用一块内存...
2017-08-08 20:09:00
74
转载 13. Roman to Integer【leetcode】
Roman to IntegerGiven a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999. 1 public class Solution { 2 public int romanToInt(String ...
2017-08-08 19:39:00
77
转载 9. Palindrome Number 回文 my second leetcode 20170807
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of converti...
2017-08-07 23:28:00
65
转载 My first_leetcode_Rever Ingeter 数字翻转java实现(办法集合)
7. Reverse IntegerReverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321If the integer's last digit is 0, what should the output be? ie, cases such a...
2017-08-07 22:38:00
111
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人