随笔分类 -  LeetCode

上一页 1 2 3 4 5 6 7 8 9 ··· 14 下一页
摘要:In a given integer array nums, there is always exactly one largest element. Find whether the largest element in the array is at least twice as much as 阅读全文
posted @ 2018-01-03 20:38 immjc 阅读(234) 评论(0) 推荐(0)
摘要:Implement int sqrt(int x). Compute and return the square root of x. x is guaranteed to be a non-negative integer. Example 1: Input: 4 Output: 2 Exampl 阅读全文
posted @ 2017-12-20 17:45 immjc 阅读(110) 评论(0) 推荐(0)
摘要:On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or two steps. Y 阅读全文
posted @ 2017-12-20 14:06 immjc 阅读(650) 评论(0) 推荐(0)
摘要:Find the minimum length word from a given dictionary words, which has all the letters from the string licensePlate. Such a word is said to complete th 阅读全文
posted @ 2017-12-20 13:18 immjc 阅读(171) 评论(0) 推荐(0)
摘要:Given a list of sorted characters letters containing only lowercase letters, and given a target letter target, find the smallest element in the list t 阅读全文
posted @ 2017-12-12 13:17 immjc 阅读(435) 评论(0) 推荐(0)
摘要:Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be 阅读全文
posted @ 2017-12-08 12:11 immjc 阅读(193) 评论(0) 推荐(0)
摘要:Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), retur 阅读全文
posted @ 2017-12-07 12:10 immjc 阅读(88) 评论(0) 推荐(0)
摘要:Winter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses. Now, you are given p 阅读全文
posted @ 2017-12-07 11:54 immjc 阅读(204) 评论(0) 推荐(0)
摘要:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov 阅读全文
posted @ 2017-12-06 20:29 immjc 阅读(132) 评论(0) 推荐(0)
摘要:Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note:n is positive and will fit within the range of a 32-bi 阅读全文
posted @ 2017-12-06 18:31 immjc 阅读(135) 评论(0) 推荐(0)
摘要:Given an array of integers sorted in ascending order, find the starting and ending position of a given target value. Your algorithm's runtime complexi 阅读全文
posted @ 2017-12-05 11:59 immjc 阅读(177) 评论(0) 推荐(0)
摘要:Given two sentences words1, words2 (each represented as an array of strings), and a list of similar word pairs pairs, determine if two sentences are s 阅读全文
posted @ 2017-12-01 18:01 immjc 阅读(331) 评论(0) 推荐(0)
摘要:An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535). Given a coordinate (sr, 阅读全文
posted @ 2017-12-01 10:06 immjc 阅读(162) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-11-21 16:20 immjc 阅读(203) 评论(0) 推荐(0)
摘要:Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: A: a1 → a2 阅读全文
posted @ 2017-11-21 10:55 immjc 阅读(135) 评论(0) 推荐(0)
摘要:Implement a MyCalendarTwo class to store your events. A new event can be added if adding the event will not cause a triple booking. Your class will ha 阅读全文
posted @ 2017-11-20 16:54 immjc 阅读(188) 评论(0) 推荐(0)
摘要:Implement a MyCalendar class to store your events. A new event can be added if adding the event will not cause a double booking. Your class will have 阅读全文
posted @ 2017-11-20 16:21 immjc 阅读(394) 评论(0) 推荐(0)
摘要:A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is a self-dividing number because 128 % 1 == 0, 128 阅读全文
posted @ 2017-11-20 11:24 immjc 阅读(757) 评论(0) 推荐(0)
摘要:Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Note: 求一个数组的范围和,可以使用动态规划来计算。 dp[x]数组表示原 阅读全文
posted @ 2017-11-19 17:58 immjc 阅读(114) 评论(0) 推荐(0)
摘要:Write a function to find the longest common prefix string amongst an array of strings. 找出字符串数组中最长的公共前缀。 思路:将字符串数组中每个字符串左对齐,排成一列,然后依次对比每个字符串的相同位置的字母。 如 阅读全文
posted @ 2017-11-17 20:20 immjc 阅读(123) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 ··· 14 下一页