随笔分类 -  LeetCode

摘要:Given an array of scores that are non negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and t 阅读全文
posted @ 2018-12-04 22:02 A-Little-Nut 阅读(106) 评论(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 len 阅读全文
posted @ 2018-12-04 22:01 A-Little-Nut 阅读(119) 评论(0) 推荐(0)
摘要:Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: + The given in 阅读全文
posted @ 2018-12-04 21:45 A-Little-Nut 阅读(151) 评论(0) 推荐(0)
摘要:In the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue. For now, suppose you are a domin 阅读全文
posted @ 2018-12-04 21:44 A-Little-Nut 阅读(137) 评论(0) 推荐(0)
摘要:Consider the string s to be the infinite wraparound string of “abcdefghijklmnopqrstuvwxyz”, so s will look like this: “…zabcdefghijklmnopqrstuvwxyzabc 阅读全文
posted @ 2018-12-04 21:42 A-Little-Nut 阅读(118) 评论(0) 推荐(0)
摘要:In the “100 game,” two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach o 阅读全文
posted @ 2018-12-04 21:39 A-Little-Nut 阅读(151) 评论(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 @ 2018-12-04 21:33 A-Little-Nut 阅读(143) 评论(0) 推荐(0)
摘要:The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calcul 阅读全文
posted @ 2018-12-04 21:30 A-Little-Nut 阅读(92) 评论(0) 推荐(0)
摘要:There are 1000 buckets, one and only one of them contains poison, the rest are filled with water. They all look the same. If a pig drinks that poison 阅读全文
posted @ 2018-12-04 21:24 A-Little-Nut 阅读(81) 评论(0) 推荐(0)
摘要:Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a g 阅读全文
posted @ 2018-12-04 21:23 A-Little-Nut 阅读(123) 评论(0) 推荐(0)
摘要:Given a non empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n 阅读全文
posted @ 2018-12-04 21:20 A-Little-Nut 阅读(131) 评论(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 @ 2018-12-04 21:18 A-Little-Nut 阅读(102) 评论(0) 推荐(0)
摘要:Given n points in the plane that are all pairwise distinct, a “boomerang” is a tuple of points (i, j, k) such that the distance between iand j equals 阅读全文
posted @ 2018-12-04 21:17 A-Little-Nut 阅读(130) 评论(0) 推荐(0)
摘要:Given a non empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both 阅读全文
posted @ 2018-12-04 21:15 A-Little-Nut 阅读(108) 评论(0) 推荐(0)
摘要:Given two non negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: + The length of both num1 and num2 is =0; 阅读全文
posted @ 2018-12-04 21:14 A-Little-Nut 阅读(85) 评论(0) 推荐(0)
摘要:A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the 阅读全文
posted @ 2018-12-04 21:09 A-Little-Nut 阅读(104) 评论(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 @ 2018-12-04 21:07 A-Little-Nut 阅读(196) 评论(0) 推荐(0)
摘要: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 @ 2018-12-04 21:05 A-Little-Nut 阅读(88) 评论(0) 推荐(0)
摘要:Find the sum of all left leaves in a given binary tree. Example: 阅读全文
posted @ 2018-12-04 21:02 A-Little-Nut 阅读(143) 评论(0) 推荐(0)
摘要:A binary watch has 4 LEDs on the top which represent the hours (0 11), and the 6 LEDs on the bottom represent the minutes (0 59). Each LED represents 阅读全文
posted @ 2018-12-03 22:12 A-Little-Nut 阅读(136) 评论(0) 推荐(0)