- 博客(150)
- 收藏
- 关注
原创 LeetCode 89 Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of
2015-03-27 02:11:26
694
原创 LeetCode 75 Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers
2015-03-27 01:16:33
681
原创 LeetCode 121 Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),
2015-03-25 06:59:58
718
原创 LeetCode 145 Binary Tree Postorder Traversal
Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].Note: Recursive solut
2015-03-25 06:54:55
575
原创 LeetCode 2 Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link
2015-03-15 05:21:45
845
原创 LeetCode 190 Reverse Bits
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 001110010
2015-03-14 02:04:18
1112
原创 LeetCode 19 Remove Nth Node From End of List
# Definition for singly-linked list.# class ListNode# attr_accessor :val, :next# def initialize(val)# @val = val# @next = nil# end# end# @param {ListNode} head# @
2015-03-14 01:47:49
446
原创 LeetCode 191 Number of 1 Bits
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11' has binary representation 000000
2015-03-11 07:36:54
438
原创 LeetCode 100 Same Tree
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.# Definition
2015-03-11 07:35:14
343
原创 LeetCode 104 Maximum Depth of Binary Tree
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 leaf node.# Definition for a binary tree no
2015-03-11 07:33:20
404
原创 LeetCode 136 Single Number
Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using e
2015-03-11 07:30:16
425
原创 495B - Modular Equations
B. Modular Equationstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLast week, Hamed learned about a new ty
2014-12-16 11:27:03
1618
原创 495A - Digital Counter
A. Digital Countertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMalek lives in an apartment block with 10
2014-12-16 08:25:50
709
原创 479A - Expression
A. Expressiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya studies in a school and he adores Maths.
2014-12-14 11:39:47
625
原创 492D - Vanya and Computer Game
D. Vanya and Computer Gametime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVanya and his friend Vova play a
2014-12-14 09:57:12
870
原创 472A - Design Tutorial: Learn from Math
A. Design Tutorial: Learn from Mathtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne way to create a task
2014-12-13 10:40:19
774
原创 485B - Valuable Resources
B. Valuable Resourcestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMany computer strategy games require b
2014-12-13 08:56:51
715
原创 160A - Twins
A. Twinstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputImagine that you have a twin brother or sister. Ha
2014-12-13 07:37:52
940
原创 492C - Vanya and Exams
C. Vanya and Examstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVanya wants to pass n exams and get the a
2014-12-13 05:36:50
927
原创 59A - Word
A. Wordtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya is very upset that many people on the Net mix
2014-12-11 06:39:25
826
原创 148A - Insomnia cure
A. Insomnia curetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output«One dragon. Two dragon. Three dragon», —
2014-12-02 12:18:32
965
原创 82A - Double Cola
A. Double Colatime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSheldon, Leonard, Penny, Rajesh and Howard ar
2014-12-02 11:24:52
1049
原创 112A - Petya and Strings
A. Petya and Stringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Petya loves presents. His mum b
2014-12-02 11:16:56
711
原创 131A - cAPS lOCK
A. cAPS lOCKtime limit per test0.5 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputwHAT DO WE NEED cAPS LOCK FOR?Caps lock i
2014-12-02 07:02:21
821
原创 492A - Vanya and Cubes
A. Vanya and Cubestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVanya got n cubes. He decided to build a
2014-12-02 05:58:48
1109
原创 133A - HQ9+
A. HQ9+time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputHQ9+ is a joke programming language which has only
2014-11-29 13:41:01
691
原创 96A - Football
A. Footballtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya loves football very much. One day, as he
2014-11-29 12:00:56
592
原创 266A - Stones on the Table
A. Stones on the Tabletime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n stones on the table in a
2014-11-29 11:35:22
512
原创 282A - Bit++
A. Bit++time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe classic programming language of Bitland is Bit+
2014-11-29 11:21:40
607
原创 116A - Tram
A. Tramtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLinear Kingdom has exactly one tram line. It has n
2014-11-29 00:38:56
1146
原创 231A - Team
A. Teamtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne day three best friends Petya, Vasya and Tonya d
2014-11-29 00:37:48
652
原创 158B - Taxi
B. Taxitime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter the lessons n groups of schoolchildren went o
2014-11-29 00:36:43
1038
原创 50A - Domino piling
A. Domino pilingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a rectangular board of M × N
2014-11-29 00:36:01
999
原创 118A - String Task
A. String Tasktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya started to attend programming lessons.
2014-11-29 00:33:24
1125
原创 71A - Way Too Long Words
A. Way Too Long Wordstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSometimes some words like "localizati
2014-11-29 00:31:41
1166
原创 158A - Next Round
A. Next Roundtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output"Contestant who earns a score equal to or gre
2014-11-29 00:29:30
886
原创 4A - Watermelon
A. Watermelontime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputOne hot summer day Pete and his friend Billy de
2014-11-29 00:28:04
420
原创 1A - Theatre Square
A. Theatre Squaretime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputTheatre Square in the capital city of Berl
2014-11-29 00:25:06
390
原创 847 - A Multiplication Game
A multiplication game Stan and Ollie play the game of multiplication by multiplying an integer p by one of the numbers 2 to 9. Stan always starts with p = 1, does his multiplication, the
2013-09-18 11:21:33
763
原创 11417 - GCD
Problem AGCDInput: Standard InputOutput: Standard Output Given the value of N, you will have to find the value of G. The definition of G is given below: Here GCD(i,
2013-09-15 13:29:24
869
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人