摘要: Count the number of prime numbers less than a non-negative number, n. Example: 一开始用最傻的方法做(逐个判断是否为素数),结果超过了time limit。。 tricky的做法是 用boolean标记每个数,每当遇到一个 阅读全文
posted @ 2019-03-03 20:24 JamieLiu 阅读(89) 评论(0) 推荐(0) 编辑
摘要: Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or 阅读全文
posted @ 2019-03-03 18:25 JamieLiu 阅读(113) 评论(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: 不难理解 但是很繁琐。 y0/x0 来记录每两点间的斜率 阅读全文
posted @ 2019-02-28 21:36 JamieLiu 阅读(130) 评论(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). Example: Note: If there i 阅读全文
posted @ 2019-02-27 21:12 JamieLiu 阅读(144) 评论(0) 推荐(0) 编辑
摘要: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. Example: Note: 解 阅读全文
posted @ 2019-02-26 21:02 JamieLiu 阅读(104) 评论(0) 推荐(0) 编辑
摘要: Given an input string, reverse the string word by word. Example: Note: A word is defined as a sequence of non-space characters. Input string may conta 阅读全文
posted @ 2019-02-26 19:58 JamieLiu 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Given an unsorted integer array, find the smallest missing positive integer. Example 1: Example 2: Example 3: Note: Your algorithm should run in O(n) 阅读全文
posted @ 2019-02-26 16:19 JamieLiu 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty array of integers, return the k most frequent elements. Example 1: Example 2: Input: nums = [1], k = 1 Output: [1] Example 2: Note: 阅读全文
posted @ 2019-02-25 22:34 JamieLiu 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Given an array of strings, group anagrams together. Example: Note: All inputs will be in lowercase. The order of your output does not matter. 很多java的接 阅读全文
posted @ 2019-02-23 10:40 JamieLiu 阅读(235) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequ 阅读全文
posted @ 2019-02-21 21:19 JamieLiu 阅读(139) 评论(0) 推荐(0) 编辑