随笔分类 -  Leetcode

上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页
leetcode 694. Number of Distinct Islands
摘要:Given a non empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4 directionally (horizontal or vertical.) Yo 阅读全文
posted @ 2017-10-08 11:21 Beserious 阅读(851) 评论(0) 推荐(0) 编辑
leetcode 687. Longest Univalue Path
摘要:Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the roo 阅读全文
posted @ 2017-10-03 21:29 Beserious 阅读(832) 评论(0) 推荐(0) 编辑
leetcode 686. Repeated String Match
摘要:Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return 1. For 阅读全文
posted @ 2017-10-03 17:39 Beserious 阅读(367) 评论(0) 推荐(0) 编辑
leetcode 507. Perfect Number
摘要:We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself. Now, given an integer n, write 阅读全文
posted @ 2017-09-25 11:36 Beserious 阅读(120) 评论(0) 推荐(0) 编辑
leetcode 681. Next Closest Time
摘要:Given a time represented in the format "HH:MM", form the next closest time by reusing the current digits. There is no limit on how many times a digit 阅读全文
posted @ 2017-09-24 23:46 Beserious 阅读(1177) 评论(0) 推荐(0) 编辑
leetcode 682. Baseball Game
摘要:You're now a baseball game point recorder. Given a list of strings, each string can be one of the 4 following types: Integer (one round's score): Dire 阅读全文
posted @ 2017-09-24 23:44 Beserious 阅读(213) 评论(0) 推荐(0) 编辑
leetcode 684. Redundant Connection
摘要:We are given a "tree" in the form of a 2D array, with distinct values for each node. In the given 2D array, each element pair [u, v] represents that v 阅读全文
posted @ 2017-09-24 23:43 Beserious 阅读(399) 评论(0) 推荐(0) 编辑
leetcode 677. Map Sum Pairs
摘要:Implement a MapSum class with insert, and sum methods. For the method insert, you'll be given a pair of (string, integer). The string represents the k 阅读全文
posted @ 2017-09-24 00:31 Beserious 阅读(222) 评论(0) 推荐(0) 编辑
leetcode 402. Remove K Digits
摘要:Given a non negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible. Note: The l 阅读全文
posted @ 2017-09-24 00:13 Beserious 阅读(92) 评论(0) 推荐(0) 编辑
leetcode 409. Longest Palindrome
摘要: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 @ 2017-09-14 12:29 Beserious 阅读(107) 评论(0) 推荐(0) 编辑
leetcode 5. Longest Palindromic Substring
摘要:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: "babad" Output: "b 阅读全文
posted @ 2017-09-10 00:42 Beserious 阅读(110) 评论(0) 推荐(0) 编辑
leetcode 2. Add Two Numbers
摘要:You are given two non empty linked lists representing two non negative integers. The digits are stored in reverse order and each of their nodes contai 阅读全文
posted @ 2017-09-06 23:12 Beserious 阅读(129) 评论(0) 推荐(0) 编辑
leetcode 11. Container With Most Water
摘要:Given n non negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo 阅读全文
posted @ 2017-09-05 12:49 Beserious 阅读(128) 评论(0) 推荐(0) 编辑
leetcode 208. Implement Trie (Prefix Tree)
摘要:Implement a trie with insert, search, and startsWith methods. Note: You may assume that all inputs are consist of lowercase letters a z. 字典树 阅读全文
posted @ 2017-09-04 20:32 Beserious 阅读(120) 评论(0) 推荐(0) 编辑
leetcode 15. 3Sum
摘要:每日一道题目,预防思维僵化 Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which giv 阅读全文
posted @ 2017-09-04 15:04 Beserious 阅读(159) 评论(0) 推荐(0) 编辑
链家2018链习生招聘 编程题三
摘要:小明有n(1 using namespace std; int dp[2010][2010]; int main() { int n; while (cin n) { vector v(n); memset(dp, 0, sizeof dp); for (int i = 0; i v[i]; // 阅读全文
posted @ 2017-09-03 17:07 Beserious 阅读(1230) 评论(7) 推荐(0) 编辑
leetcode 669. Trim a Binary Search Tree
摘要:Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R = L). You might 阅读全文
posted @ 2017-09-03 12:28 Beserious 阅读(263) 评论(0) 推荐(0) 编辑
leetcode 671. Second Minimum Node In a Binary Tree
摘要:Given a non empty special binary tree consisting of nodes with the non negative value, where each node in this tree has exactly two or zero sub node. 阅读全文
posted @ 2017-09-03 11:13 Beserious 阅读(181) 评论(0) 推荐(0) 编辑
leetcode 670. Maximum Swap
摘要:Given a non negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get. 阅读全文
posted @ 2017-09-03 11:11 Beserious 阅读(408) 评论(0) 推荐(0) 编辑
leetcode 290. Word Pattern
摘要: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 @ 2017-09-02 20:20 Beserious 阅读(105) 评论(0) 推荐(0) 编辑

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