随笔分类 - leetcode
摘要:题目Single Number通过率45.1%难度Medium Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should ...
阅读全文
摘要:题目Merge Sorted Array通过率30.7%难度EasyGiven two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough sp...
阅读全文
摘要:题目Merge Two Sorted Lists通过率33.2%难度EasyMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the ...
阅读全文
摘要:题目Majority Element通过率33.8%难度EasyGiven an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋t...
阅读全文
摘要:题目Excel Sheet Column Title通过率17.2%难度EasyGiven a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 ...
阅读全文
摘要:题目Excel Sheet Column Number通过率40.5%难度EasyRelated to questionExcel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corre...
阅读全文
摘要:题目Pascal's Triangle II通过率29.8%难度EasyGiven an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you o...
阅读全文
摘要:题目Pascal's Triangle通过率30.7%难度EasyGivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], ...
阅读全文
摘要:You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb...
阅读全文
摘要:Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth...
阅读全文
摘要:题目Roman to Integer通过率34.2%难度EasyGiven a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.首先来看一下罗马数字的编...
阅读全文
摘要:题目Remove Duplicates from Sorted Array通过率31.9%难度EasyGiven a sorted array, remove the duplicates in place such that each element appear onlyonceand retu...
阅读全文
摘要:题目Remove Duplicates from Sorted List通过率34.4%难度EasyGiven a sorted linked list, delete all duplicates such that each element appear onlyonce.For example...
阅读全文
摘要:题目Maximum Depth of Binary Tree通过率44.2%难度EasyGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest pat...
阅读全文
摘要:题目Reverse Integer通过率34.2%难度EasyReverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you ...
阅读全文
摘要:题目 Binary Tree Level Order Traversal II通过率30.6%难度EasyGiven a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from ...
阅读全文
摘要:题目Same Tree通过率42.0%难度EasyGiven two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are ...
阅读全文
摘要:题目Pow( x, n)通过率26.2%难度MediumImplement pow(x,n). 初步构想:开始拿到题目就以为是简单的求幂运算,一直迭代乘法就可以了,事实证明,想法过于简单!!结果自己给自己挖了个坑,根本没有考虑到数的大小以及溢出的问题,自己默认n为正数了,要注意幂指数为负数的情况是...
阅读全文
摘要:水平实在太low了,尤其是代码能力,一直以屌丝女程序猿为宏图目标,突然发现只成功了一半-屌丝女。 从今天开始code,每天两道题。 记录于此,以勉于己。 2014.12.12 ...
阅读全文
浙公网安备 33010602011771号