随笔分类 -  LeetCode

上一页 1 ··· 9 10 11 12 13 14 下一页
摘要: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. For example, giv 阅读全文
posted @ 2017-07-12 11:34 immjc 阅读(168) 评论(0) 推荐(0)
摘要:You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way. The null node needs to be rep 阅读全文
posted @ 2017-07-12 11:11 immjc 阅读(155) 评论(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 @ 2017-07-12 10:33 immjc 阅读(151) 评论(0) 推荐(0)
摘要:Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 Trivia:This problem was inspired by this original tweet by Max Howell: Go 阅读全文
posted @ 2017-07-11 20:14 immjc 阅读(121) 评论(0) 推荐(0)
摘要:Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] 阅读全文
posted @ 2017-07-11 20:01 immjc 阅读(126) 评论(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 @ 2017-07-11 10:53 immjc 阅读(131) 评论(0) 推荐(0)
摘要:Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l 阅读全文
posted @ 2017-07-11 10:12 immjc 阅读(96) 评论(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 @ 2017-07-10 21:44 immjc 阅读(156) 评论(0) 推荐(0)
摘要:Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a linear runtime complex 阅读全文
posted @ 2017-07-10 16:48 immjc 阅读(152) 评论(0) 推荐(0)
摘要:Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Note: The input array will only contain 0 and 1. The length 阅读全文
posted @ 2017-07-10 16:43 immjc 阅读(124) 评论(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 @ 2017-07-10 16:23 immjc 阅读(121) 评论(0) 推荐(0)
摘要:You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston 阅读全文
posted @ 2017-07-10 12:08 immjc 阅读(141) 评论(0) 推荐(0)
摘要:You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/ve 阅读全文
posted @ 2017-07-10 11:51 immjc 阅读(156) 评论(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 @ 2017-07-10 11:26 immjc 阅读(135) 评论(0) 推荐(0)
摘要:Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the numbe 阅读全文
posted @ 2017-07-10 10:20 immjc 阅读(144) 评论(0) 推荐(0)
摘要:Write a function that takes a string as input and returns the string reversed. Example:Given s = "hello", return "olleh". 题目要求反转一个字符串,利用双指针求解。 相关题目:Re 阅读全文
posted @ 2017-07-10 09:59 immjc 阅读(119) 评论(0) 推荐(0)
摘要:Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: Note: 题目要求一个非空二叉树的每一层数字和的平均值,并返 阅读全文
posted @ 2017-07-10 09:51 immjc 阅读(1206) 评论(0) 推荐(0)
摘要:TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it returns a short URL such as http 阅读全文
posted @ 2017-07-09 13:52 immjc 阅读(441) 评论(0) 推荐(0)
摘要: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 @ 2017-07-09 12:37 immjc 阅读(162) 评论(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 @ 2017-07-09 11:41 immjc 阅读(166) 评论(0) 推荐(0)

上一页 1 ··· 9 10 11 12 13 14 下一页