10 uj_mosquito

尚未进行身份认证

暂无相关简介

等级
TA的排名 3w+

shell编程小tip(陆续更新)

1、运算e.g.((data=$data/10))和data=`expr$data/10`的区别有的时候取出来的数data=08而不是8,,这时候用第一种就会出语法错误-bash:((:data=08:valuetoogreatforbase(errortokenis"08")这是就只能用第二种data=`expr$data/10`

2015-03-10 12:24:49

Sum Root to Leaf Numbers

Givenabinarytreecontainingdigitsfrom 0-9 only,eachroot-to-leafpathcouldrepresentanumber.Anexampleistheroot-to-leafpath 1->2->3 whichrepresentsthenumber 123.Findthetota

2015-02-04 17:44:12

4Sum

Givenanarray S of n integers,arethereelements a, b, c,and d in S suchthat a + b + c + d =target?Findalluniquequadrupletsinthearraywhichgivesthesumoftarget.Note:Element

2015-02-04 17:14:13

3Sum Closest

Givenanarray S of n integers,findthreeintegersin S suchthatthesumisclosesttoagivennumber,target.Returnthesumofthethreeintegers.Youmayassumethateachinputwouldhaveexact

2015-02-04 16:11:00

3Sum

Givenanarray S of n integers,arethereelements a, b, c in S suchthat a + b + c =0?Findalluniquetripletsinthearraywhichgivesthesumofzero.Note:Elementsinatriplet(a,b,c

2015-02-04 12:59:21

Construct Binary Tree from Inorder and Postorder Traversal

Giveninorderandpostordertraversalofatree,constructthebinarytree.Note:Youmayassumethatduplicatesdonotexistinthetree.#include#includetypedefstructTreeNode{intv

2015-01-30 17:57:45

Path Sum II

Givenabinarytreeandasum,findallroot-to-leafpathswhereeachpath'ssumequalsthegivensum.Forexample:Giventhebelowbinarytreeand sum=22,5/\

2015-01-30 15:32:53

Flatten Binary Tree to Linked List

Givenabinarytree,flattenittoalinkedlistin-place.Forexample,Given1/\25/\\346Theflattenedtreeshouldlooklike:1

2015-01-30 14:44:42

Next Permutation

Implementnextpermutation,whichrearrangesnumbersintothelexicographicallynextgreaterpermutationofnumbers.Ifsucharrangementisnotpossible,itmustrearrangeitasthelowestpossible

2015-01-30 13:57:00

Balanced Binary Tree

Givenabinarytree,determineifitisheight-balanced.Forthisproblem,aheight-balancedbinarytreeisdefinedasabinarytreeinwhichthedepthofthetwosubtreesof every nodeneverdiffe

2015-01-30 11:25:48

Integer to Roman

Givenaninteger,convertittoaromannumeral.Inputisguaranteedtobewithintherangefrom1to3999.stringintToRoman(intnum){intnumarr[]={1,4,5,9,10,40,50,90,100,400,

2015-01-29 15:39:25

Longest Palindromic Substring

Givenastring S,findthelongestpalindromicsubstringin S.Youmayassumethatthemaximumlengthof S is1000,andthereexistsoneuniquelongestpalindromicsubstring.#include#includ

2015-01-27 13:57:31

Gas Station

Thereare N gasstationsalongacircularroute,wheretheamountofgasatstation i is gas[i].Youhaveacarwithanunlimitedgastankanditcosts cost[i] ofgastotravelfromstation i to

2015-01-23 18:12:10

Construct Binary Tree from Preorder and Inorder Traversal

Givenpreorderandinordertraversalofatree,constructthebinarytree.Note:Youmayassumethatduplicatesdonotexistinthetree.#include#includetypedefstructTreeNode{intval

2015-01-23 15:49:44

Partition List

Givenalinkedlistandavalue x,partitionitsuchthatallnodeslessthan x comebeforenodesgreaterthanorequalto x.Youshouldpreservetheoriginalrelativeorderofthenodesineachof

2015-01-21 17:55:54

Permutations

Givenacollectionofnumbers,returnallpossiblepermutations.Forexample,[1,2,3] havethefollowingpermutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2],and [3,2,1].C++:classS

2015-01-20 11:48:28

Pow(x, n)

Pow(x,n) TotalAccepted: 35792 TotalSubmissions: 135252MySubmissionsQuestion Solution Implementpow(x, n).#includedoubleipow(doublex,intn){if(n==0)r

2015-01-20 10:19:39

N-Queens II

FollowupforN-Queensproblem.Now,insteadoutputtingboardconfigurations,returnthetotalnumberofdistinctsolutions.classSolution{public:voidprint(intqueue[],intn,vector>&

2015-01-19 18:50:58

N-Queens

The n-queenspuzzleistheproblemofplacing n queensonan n×n chessboardsuchthatnotwoqueensattackeachother.Givenaninteger n,returnalldistinctsolutionstothe n-queenspuzzle.

2015-01-19 18:23:44

Multiply Strings

Giventwonumbersrepresentedasstrings,returnmultiplicationofthenumbersasastring.Note:Thenumberscanbearbitrarilylargeandarenon-negative.#include#include#includechar*mul

2015-01-14 20:03:16

查看更多

勋章 我的勋章
  • 持之以恒
    持之以恒
    授予每个自然月内发布4篇或4篇以上原创或翻译IT博文的用户。不积跬步无以至千里,不积小流无以成江海,程序人生的精彩需要坚持不懈地积累!