随笔分类 -  Leetcode

上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 23 下一页
摘要:Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a lette 阅读全文
posted @ 2018-11-14 16:39 Veritas_des_Liberty 阅读(191) 评论(0) 推荐(0) 编辑
摘要:Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. Example 1: Example 2: my code: can't determine the 阅读全文
posted @ 2018-11-13 22:31 Veritas_des_Liberty 阅读(182) 评论(0) 推荐(0) 编辑
摘要:Count the number of prime numbers less than a non-negative number, n. Example: Approach #1: C++. Approach #2: Java. Approach #3: Python. 阅读全文
posted @ 2018-11-13 20:22 Veritas_des_Liberty 阅读(288) 评论(0) 推荐(0) 编辑
摘要:Given a list of unique words, find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e. words[i] + 阅读全文
posted @ 2018-11-12 19:11 Veritas_des_Liberty 阅读(249) 评论(0) 推荐(0) 编辑
摘要:You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time 阅读全文
posted @ 2018-11-12 12:38 Veritas_des_Liberty 阅读(190) 评论(0) 推荐(0) 编辑
摘要:Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrenc 阅读全文
posted @ 2018-11-12 11:49 Veritas_des_Liberty 阅读(198) 评论(0) 推荐(0) 编辑
摘要:All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to 阅读全文
posted @ 2018-11-12 10:59 Veritas_des_Liberty 阅读(250) 评论(0) 推荐(0) 编辑
摘要:Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating 阅读全文
posted @ 2018-11-11 22:36 Veritas_des_Liberty 阅读(202) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, return the inorder traversal of its nodes' values. Example: Follow up: Recursive solution is trivial, could you do it iteratively 阅读全文
posted @ 2018-11-11 21:11 Veritas_des_Liberty 阅读(159) 评论(0) 推荐(0) 编辑
摘要:A positive integer is magical if it is divisible by either A or B. Return the N-th magical number. Since the answer may be very large, return it modul 阅读全文
posted @ 2018-11-10 18:40 Veritas_des_Liberty 阅读(340) 评论(0) 推荐(0) 编辑
摘要:Koko loves to eat bananas. There are N piles of bananas, the i-th pile has piles[i] bananas. The guards have gone and will come back in H hours. Koko 阅读全文
posted @ 2018-11-10 17:51 Veritas_des_Liberty 阅读(296) 评论(0) 推荐(0) 编辑
摘要:Given a sorted (in ascending order) integer array nums of n elements and a target value, write a function to search target in nums. If targetexists, t 阅读全文
posted @ 2018-11-10 17:04 Veritas_des_Liberty 阅读(272) 评论(0) 推荐(0) 编辑
摘要:Return the length of the shortest, non-empty, contiguous subarray of A with sum at least K. If there is no non-empty subarray with sum at least K, ret 阅读全文
posted @ 2018-11-10 16:58 Veritas_des_Liberty 阅读(293) 评论(0) 推荐(0) 编辑
摘要:Let's call an array A a mountain if the following properties hold: A.length >= 3 There exists some 0 < i < A.length - 1 such that A[0] < A[1] < ... A[ 阅读全文
posted @ 2018-11-09 21:14 Veritas_des_Liberty 阅读(219) 评论(0) 推荐(0) 编辑
摘要:Let f(x) be the number of zeroes at the end of x!. (Recall that x! = 1 * 2 * 3 * ... * x, and by convention, 0! = 1.) For example, f(3) = 0 because 3! 阅读全文
posted @ 2018-11-09 20:52 Veritas_des_Liberty 阅读(293) 评论(0) 推荐(0) 编辑
摘要:A sorted list A contains 1, plus some number of primes. Then, for every p < q in the list, we consider the fraction p/q. What is the K-th smallest fra 阅读全文
posted @ 2018-11-09 18:48 Veritas_des_Liberty 阅读(170) 评论(0) 推荐(0) 编辑
摘要:On an N x N grid, each square grid[i][j] represents the elevation at that point (i,j). Now rain starts to fall. At time t, the depth of the water ever 阅读全文
posted @ 2018-11-09 16:59 Veritas_des_Liberty 阅读(171) 评论(0) 推荐(0) 编辑
摘要:Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays. Example 1: Note: Approach #1: Dynamic programm 阅读全文
posted @ 2018-11-08 21:08 Veritas_des_Liberty 阅读(181) 评论(0) 推荐(0) 编辑
摘要:Given an integer array, return the k-th smallest distance among all the pairs. The distance of a pair (A, B) is defined as the absolute difference bet 阅读全文
posted @ 2018-11-08 20:48 Veritas_des_Liberty 阅读(202) 评论(0) 推荐(0) 编辑
摘要:Nearly every one have used the Multiplication Table. But could you find out the k-th smallest number quickly from the multiplication table? Given the 阅读全文
posted @ 2018-11-08 17:34 Veritas_des_Liberty 阅读(288) 评论(0) 推荐(0) 编辑

上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 23 下一页