随笔分类 -  LeetCode

摘要:Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->4->5->NULL and k = 2, return 4->5->1->2-> 阅读全文
posted @ 2015-07-01 14:38 Mr.do 阅读(112) 评论(0) 推荐(0) 编辑
摘要:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo 阅读全文
posted @ 2015-06-30 11:25 Mr.do 阅读(114) 评论(0) 推荐(0) 编辑
摘要:Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). For example, S = "ADOBECO 阅读全文
posted @ 2015-06-29 20:44 Mr.do 阅读(99) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers, find out whether there are two distinct indices i and j in the array such that the difference between nums[i] and nums[j]  阅读全文
posted @ 2015-06-28 20:18 Mr.do 阅读(131) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers and an integer k, find out whether there there are two distinct indices i and j in the array such that nums[i] = nums[j] an 阅读全文
posted @ 2015-06-28 09:53 Mr.do 阅读(119) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr 阅读全文
posted @ 2015-06-28 09:28 Mr.do 阅读(121) 评论(0) 推荐(0) 编辑
摘要:Follow up for "Find Minimum in Rotated Sorted Array": What if duplicates are allowed? Would this affect the run-time complexity? How and why? Suppose 阅读全文
posted @ 2015-06-27 11:19 Mr.do 阅读(109) 评论(0) 推荐(0) 编辑
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. 阅读全文
posted @ 2015-06-27 10:59 Mr.do 阅读(131) 评论(0) 推荐(0) 编辑
摘要:Follow up for "Search in Rotated Sorted Array": What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a functi 阅读全文
posted @ 2015-06-25 15:38 Mr.do 阅读(132) 评论(0) 推荐(0) 编辑
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target va 阅读全文
posted @ 2015-06-24 19:46 Mr.do 阅读(122) 评论(0) 推荐(0) 编辑
摘要:Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 要求不使用乘法、除法或模运算实现: dividend/divisor,也就是 阅读全文
posted @ 2015-06-22 14:43 Mr.do 阅读(121) 评论(0) 推荐(0) 编辑
摘要:Implement pow(x, n). 阅读全文
posted @ 2015-06-21 14:52 Mr.do 阅读(132) 评论(0) 推荐(0) 编辑
摘要:Implement int sqrt(int x). Compute and return the square root of x. 阅读全文
posted @ 2015-06-21 11:35 Mr.do 阅读(138) 评论(0) 推荐(0) 编辑
摘要:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of 阅读全文
posted @ 2015-06-18 18:39 Mr.do 阅读(99) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two n 阅读全文
posted @ 2015-06-17 16:29 Mr.do 阅读(99) 评论(0) 推荐(0) 编辑
摘要:Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1,3,3,1]. Note: Could you optimize your algorithm to 阅读全文
posted @ 2015-06-16 15:12 Mr.do 阅读(80) 评论(0) 推荐(0) 编辑
摘要:Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, Return 阅读全文
posted @ 2015-06-15 11:06 Mr.do 阅读(99) 评论(0) 推荐(0) 编辑
摘要:Invert a binary tree. to Trivia: This problem was inspired by this original tweet by Max Howell: 阅读全文
posted @ 2015-06-13 15:12 Mr.do 阅读(104) 评论(0) 推荐(0) 编辑
摘要:Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is a 阅读全文
posted @ 2015-06-12 10:22 Mr.do 阅读(119) 评论(0) 推荐(0) 编辑
摘要:Write a function to find the longest common prefix string amongst an array of strings. 阅读全文
posted @ 2015-06-11 19:54 Mr.do 阅读(118) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示