随笔分类 -  LeetCode

摘要:Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of th 阅读全文
posted @ 2018-12-05 22:46 A-Little-Nut 阅读(98) 评论(0) 推荐(0)
摘要:In MATLAB, there is a very useful function called ‘reshape’, which can reshape a matrix into a new one with different size but keep its original data. 阅读全文
posted @ 2018-12-05 22:44 A-Little-Nut 阅读(123) 评论(0) 推荐(0)
摘要:Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the absolute difference between the sum of all left subt 阅读全文
posted @ 2018-12-05 22:41 A-Little-Nut 阅读(98) 评论(0) 推荐(0)
摘要:Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of mi 阅读全文
posted @ 2018-12-05 22:40 A-Little-Nut 阅读(93) 评论(0) 推荐(0)
摘要:Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. E 阅读全文
posted @ 2018-12-05 22:38 A-Little-Nut 阅读(100) 评论(0) 推荐(0)
摘要:You are given a string representing an attendance record for a student. The record only contains the following three characters: ‘A’ : Absent. ‘L’ : L 阅读全文
posted @ 2018-12-05 22:37 A-Little-Nut 阅读(127) 评论(0) 推荐(0)
摘要:Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longestpath betwee 阅读全文
posted @ 2018-12-05 22:35 A-Little-Nut 阅读(141) 评论(0) 推荐(0)
摘要:Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there ar 阅读全文
posted @ 2018-12-05 22:32 A-Little-Nut 阅读(135) 评论(0) 推荐(0)
摘要:Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all 阅读全文
posted @ 2018-12-05 22:31 A-Little-Nut 阅读(107) 评论(0) 推荐(0)
摘要:Given a binary search tree with non negative values, find the minimum absolute difference between values of any two nodes. Example: Note: There are at 阅读全文
posted @ 2018-12-05 22:30 A-Little-Nut 阅读(110) 评论(0) 推荐(0)
摘要:Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is defi 阅读全文
posted @ 2018-12-05 22:29 A-Little-Nut 阅读(151) 评论(0) 推荐(0)
摘要:Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of 阅读全文
posted @ 2018-12-05 22:20 A-Little-Nut 阅读(169) 评论(0) 推荐(0)
摘要:Given a string s, find the longest palindromic subsequence’s length in s. You may assume that the maximum length of s is 1000. Example 1: Example 2: 分 阅读全文
posted @ 2018-12-05 22:18 A-Little-Nut 阅读(104) 评论(0) 推荐(0)
摘要:Given a binary tree, find the leftmost value in the last row of the tree. Example 1: Example 2: Note: You may assume the tree (i.e., the given root no 阅读全文
posted @ 2018-12-05 22:16 A-Little-Nut 阅读(97) 评论(0) 推荐(0)
摘要:Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: “Gold Medal”, “Sil 阅读全文
posted @ 2018-12-05 22:14 A-Little-Nut 阅读(98) 评论(0) 推荐(0)
摘要:Given an integer, return its base 7 string representation. Example 1: Example 2: Note: The input will be in range of [ 1e7, 1e7]. class Solution { //水 阅读全文
posted @ 2018-12-05 22:13 A-Little-Nut 阅读(105) 评论(0) 推荐(0)
摘要:Given a List of words, return the words that can be typed using letters of alphabet on only one row’s of American keyboard like the image below. Examp 阅读全文
posted @ 2018-12-04 22:10 A-Little-Nut 阅读(126) 评论(0) 推荐(0)
摘要:You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1‘ 阅读全文
posted @ 2018-12-04 22:09 A-Little-Nut 阅读(129) 评论(0) 推荐(0)
摘要:You are given a list of non negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and . For each integer, you should choose on 阅读全文
posted @ 2018-12-04 22:06 A-Little-Nut 阅读(105) 评论(0) 推荐(0)
摘要:For a web developer, it is very important to know how to design a web page’s size. So, given a specific rectangular web page’s area, your job by now i 阅读全文
posted @ 2018-12-04 22:04 A-Little-Nut 阅读(126) 评论(0) 推荐(0)