随笔分类 -  LeetCode

1 2 3 4 5 ··· 12 下一页
摘要:给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。 示例 1: 示例 2: 阅读全文
posted @ 2019-05-16 10:55 __Meng 阅读(156) 评论(0) 推荐(0) 编辑
摘要:C++: 阅读全文
posted @ 2019-05-14 16:35 __Meng 阅读(125) 评论(0) 推荐(0) 编辑
摘要:C++: 阅读全文
posted @ 2019-05-14 16:03 __Meng 阅读(116) 评论(0) 推荐(0) 编辑
摘要:给定一个用字符数组表示的 CPU 需要执行的任务列表。其中包含使用大写的 A - Z 字母表示的26 种不同种类的任务。任务可以以任意顺序执行,并且每个任务都可以在 1 个单位时间内执行完。CPU 在任何一个单位时间内都可以执行一个任务,或者在待命状态。 然而,两个相同种类的任务之间必须有长度为 n 阅读全文
posted @ 2019-05-14 15:45 __Meng 阅读(174) 评论(0) 推荐(0) 编辑
摘要:给定一个字符串数组,将字母异位词组合在一起。字母异位词指字母相同,但排列不同的字符串。 示例: 说明: 所有输入均为小写字母。 不考虑答案输出的顺序。 C++: 阅读全文
posted @ 2019-05-14 11:10 __Meng 阅读(111) 评论(0) 推荐(0) 编辑
摘要:根据每日 气温 列表,请重新生成一个列表,对应位置的输入是你需要再等待多久温度才会升高的天数。如果之后都不会升高,请输入 0 来代替。 例如,给定一个列表 temperatures = [73, 74, 75, 71, 69, 72, 76, 73],你的输出应该是 [1, 1, 4, 2, 1, 阅读全文
posted @ 2019-05-14 09:59 __Meng 阅读(168) 评论(0) 推荐(0) 编辑
摘要:Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer 阅读全文
posted @ 2019-04-25 11:08 __Meng 阅读(150) 评论(0) 推荐(0) 编辑
摘要:Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ BST's 阅读全文
posted @ 2019-03-31 13:17 __Meng 阅读(112) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only 阅读全文
posted @ 2019-03-31 13:10 __Meng 阅读(134) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, return the postorder traversal of its nodes' values. Example: Follow up: Recursive solution is trivial, could you do it iterative 阅读全文
posted @ 2019-03-28 16:39 __Meng 阅读(105) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, return the preorder traversal of its nodes' values. Example: Follow up: Recursive solution is trivial, could you do it iterativel 阅读全文
posted @ 2019-03-28 16:26 __Meng 阅读(101) 评论(0) 推荐(0) 编辑
摘要:Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You may not modify the values in the list's nodes, only nodes its 阅读全文
posted @ 2019-03-27 11:22 __Meng 阅读(114) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. Example 阅读全文
posted @ 2019-03-26 11:25 __Meng 阅读(120) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes 阅读全文
posted @ 2019-03-25 19:43 __Meng 阅读(121) 评论(0) 推荐(0) 编辑
摘要:Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjac 阅读全文
posted @ 2019-01-31 13:16 __Meng 阅读(154) 评论(0) 推荐(0) 编辑
摘要:Given a string containing only digits, restore it by returning all possible valid IP address combinations. Example: 阅读全文
posted @ 2019-01-30 21:11 __Meng 阅读(179) 评论(0) 推荐(0) 编辑
摘要:There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct 阅读全文
posted @ 2019-01-30 19:44 __Meng 阅读(175) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. Your algorithm's runtime com 阅读全文
posted @ 2019-01-29 14:15 __Meng 阅读(132) 评论(0) 推荐(0) 编辑
摘要:Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this single element 阅读全文
posted @ 2019-01-29 12:39 __Meng 阅读(240) 评论(0) 推荐(0) 编辑
摘要:Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is po 阅读全文
posted @ 2019-01-28 13:44 __Meng 阅读(116) 评论(0) 推荐(0) 编辑

1 2 3 4 5 ··· 12 下一页
点击右上角即可分享
微信分享提示