随笔分类 -  Leetcode

上一页 1 2 3 4 5 6 7 ··· 19 下一页
摘要:Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. 阅读全文
posted @ 2017-03-25 07:35 amazingzoe 阅读(123) 评论(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-03-22 08:12 amazingzoe 阅读(120) 评论(0) 推荐(0)
摘要:During the NBA playoffs, we always arrange the rather strong team to play with the rather weak team, like make the rank 1 team play with the rank nth  阅读全文
posted @ 2017-03-22 07:37 amazingzoe 阅读(252) 评论(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-03-22 07:12 amazingzoe 阅读(153) 评论(0) 推荐(0)
摘要:Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an inte 阅读全文
posted @ 2017-03-22 06:40 amazingzoe 阅读(382) 评论(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 @ 2017-03-22 06:12 amazingzoe 阅读(180) 评论(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 @ 2017-03-22 05:47 amazingzoe 阅读(136) 评论(0) 推荐(0)
摘要:Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes. Example: Input: 1 \ 3 / 2 O 阅读全文
posted @ 2017-02-28 20:26 amazingzoe 阅读(611) 评论(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-02-28 20:13 amazingzoe 阅读(133) 评论(0) 推荐(0)
摘要:Shuffle a set of numbers without duplicates. Example: 阅读全文
posted @ 2017-02-28 20:01 amazingzoe 阅读(115) 评论(0) 推荐(0)
摘要:Suppose you have N integers from 1 to N. We define a beautiful arrangement as an array that is constructed by these N numbers successfully if one of t 阅读全文
posted @ 2017-02-28 18:05 amazingzoe 阅读(328) 评论(0) 推荐(0)
摘要:Let's play the minesweeper game (Wikipedia, online game)! You are given a 2D char matrix representing the game board. 'M' represents an unrevealed min 阅读全文
posted @ 2017-02-28 17:38 amazingzoe 阅读(278) 评论(0) 推荐(0)
摘要:Design a Tic-tac-toe game that is played between two players on a n x n grid. You may assume the following rules: Example: Follow up:Could you do bett 阅读全文
posted @ 2017-02-24 21:29 amazingzoe 阅读(156) 评论(0) 推荐(0)
摘要:Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Example:Given n = 2, return 91. (The answer should be the 阅读全文
posted @ 2017-02-24 21:17 amazingzoe 阅读(150) 评论(0) 推荐(0)
摘要:Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order as shown in the below image. Example: Note: 阅读全文
posted @ 2017-02-24 20:01 amazingzoe 阅读(212) 评论(0) 推荐(0)
摘要:You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contai 阅读全文
posted @ 2017-02-24 19:29 amazingzoe 阅读(163) 评论(0) 推荐(0)
摘要:Given a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The 阅读全文
posted @ 2017-02-24 19:09 amazingzoe 阅读(160) 评论(0) 推荐(0)
摘要:A magical string S consists of only '1' and '2' and obeys the following rules: The string S is magical because concatenating the number of contiguous 阅读全文
posted @ 2017-02-24 18:19 amazingzoe 阅读(255) 评论(0) 推荐(0)
摘要:Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen. Follow up:Wha 阅读全文
posted @ 2017-02-19 19:34 amazingzoe 阅读(141) 评论(0) 推荐(0)
摘要:Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2,2,3] and k = 2, return [1,2]. Note: You may assum 阅读全文
posted @ 2017-02-19 19:27 amazingzoe 阅读(147) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 ··· 19 下一页