随笔分类 -  Leetcode

上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 23 下一页
摘要:Given a string S that only contains "I" (increase) or "D" (decrease), let N = S.length. Return any permutation A of [0, 1, ..., N] such that for all i 阅读全文
posted @ 2018-11-18 20:51 Veritas_des_Liberty 阅读(235) 评论(0) 推荐(0) 编辑
摘要:Preorder: Approach #1: Recurisive. Approach #2: Iteratively.[Java] Approach #3: Morris Traversal.[C++] Using Morris Traversal can don't use recurisive 阅读全文
posted @ 2018-11-18 18:20 Veritas_des_Liberty 阅读(221) 评论(0) 推荐(0) 编辑
摘要:We are given an array A of N lowercase letter strings, all of the same length. Now, we may choose any set of deletion indices, and for each string, we 阅读全文
posted @ 2018-11-18 12:30 Veritas_des_Liberty 阅读(277) 评论(0) 推荐(0) 编辑
摘要:Given an array A of integers, return true if and only if it is a valid mountain array. Recall that A is a mountain array if and only if: A.length >= 3 阅读全文
posted @ 2018-11-18 12:29 Veritas_des_Liberty 阅读(171) 评论(0) 推荐(0) 编辑
摘要:Sometimes people repeat letters to represent extra feeling, such as "hello" -> "heeellooo", "hi" -> "hiiii". Here, we have groups, of adjacent letters 阅读全文
posted @ 2018-11-17 12:09 Veritas_des_Liberty 阅读(202) 评论(0) 推荐(0) 编辑
摘要:A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com 阅读全文
posted @ 2018-11-17 12:04 Veritas_des_Liberty 阅读(161) 评论(0) 推荐(0) 编辑
摘要:Given a string, sort it in decreasing order based on the frequency of characters. Example 1: Example 2: Example 3: Approach #1: c++. 阅读全文
posted @ 2018-11-16 22:36 Veritas_des_Liberty 阅读(244) 评论(0) 推荐(0) 编辑
摘要:Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between i and j equals 阅读全文
posted @ 2018-11-16 22:25 Veritas_des_Liberty 阅读(269) 评论(0) 推荐(0) 编辑
摘要:Given a string s and a non-empty string p, find all the start indices of p's anagrams in s. Strings consists of lowercase English letters only and the 阅读全文
posted @ 2018-11-16 19:09 Veritas_des_Liberty 阅读(244) 评论(0) 推荐(0) 编辑
摘要:Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This 阅读全文
posted @ 2018-11-16 15:49 Veritas_des_Liberty 阅读(180) 评论(0) 推荐(0) 编辑
摘要:Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at 阅读全文
posted @ 2018-11-16 15:03 Veritas_des_Liberty 阅读(171) 评论(0) 推荐(0) 编辑
摘要:Design a data structure that supports all following operations in average O(1) time. Note: Duplicate elements are allowed. Example: Approach #1: C++. 阅读全文
posted @ 2018-11-15 22:33 Veritas_des_Liberty 阅读(209) 评论(0) 推荐(0) 编辑
摘要:Design a data structure that supports all following operations in average O(1) time. insert(val): Inserts an item val to the set if not already presen 阅读全文
posted @ 2018-11-15 21:44 Veritas_des_Liberty 阅读(233) 评论(0) 推荐(0) 编辑
摘要:Design a simplified version of Twitter where users can post tweets, follow/unfollow another user and is able to see the 10 most recent tweets in the u 阅读全文
posted @ 2018-11-15 21:03 Veritas_des_Liberty 阅读(185) 评论(0) 推荐(0) 编辑
摘要:Given a non-empty array of integers, return the k most frequent elements. Example 1: Input: nums = [1,1,1,2,2,3], k = 2 Output: [1,2] Example 2: Input 阅读全文
posted @ 2018-11-15 15:13 Veritas_des_Liberty 阅读(242) 评论(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 @ 2018-11-15 14:37 Veritas_des_Liberty 阅读(247) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the  阅读全文
posted @ 2018-11-14 22:39 Veritas_des_Liberty 阅读(216) 评论(0) 推荐(0) 编辑
摘要:Given a non-empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runti 阅读全文
posted @ 2018-11-14 21:56 Veritas_des_Liberty 阅读(250) 评论(0) 推荐(0) 编辑
摘要:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy 阅读全文
posted @ 2018-11-14 21:23 Veritas_des_Liberty 阅读(247) 评论(0) 推荐(0) 编辑
摘要:Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive intege 阅读全文
posted @ 2018-11-14 19:53 Veritas_des_Liberty 阅读(288) 评论(0) 推荐(0) 编辑

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