E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
cc150
cc150
Chapter 2 | Linked Lists 2.5 add two integer LinkedList, return LinkedList as a sum
2.5 You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order, such that the 1’s digit is at the head of the list. Write a func
·
2015-11-11 09:00
LinkedList
[
cc150
] check palindrome of a singly linked list
Problem: Implement a function to check if a singly linked list is a palindrome. 思路: 最简单的方法是 Reverse and compare. 另外一种非常经典的办法是用 Recursive 的思路,把一个list看成这种形式: 0 ( 1 ( 2 ( 3 ) 2 ) 1 ) 0 0 ( 1 (
·
2015-11-11 07:36
check
Implement Stack using Queues
做,没写 class MyStack { public Queue<Integer> q = new LinkedList<Integer>(); //
cc150
·
2015-10-31 12:41
Queue
Palindrome Linked List
解题思路:
CC150
中的原题2.7。 有好几种解
·
2015-10-30 14:45
list
Linked List Cycle leetcode java (链表检测环)
题解: 这道题连带着II是很经典的,在看
CC150
时候,纠结这个问题纠结了很久。在读了很多网上资料还有书的讲解以及和别人讨论
·
2015-10-21 10:26
LeetCode
大公司笔试面试有哪些经典算法题目?
按照循序渐进的原则,一一介绍:
cc150
,全名crackingthecodinginterview-150ProgrammingQuestionsandSolutions。
oNever_say_love
·
2015-10-15 18:00
算法
面试
《数据结构》学习-- Hash(1) --Hash简介
常用的HashFunction总结本系列是《数据结构与算法分析-C语言描述》(DataStructuresandAlgorithmAnalysisinC,作者MarkWeiss)一书的学习笔记,当我在做
cc150
jiangfan2014
·
2015-05-24 16:00
数据结构
hash
程序员不得不知道的技术面试资料大全
CareerCup.com
CC150
作者搞的网站,也是著名的漏题网站之一。大家会在上面讨论各个公司的面试题。Glassdoor.com一个给公司打分的网站,类似yelp的公司版。
九章算法
·
2015-05-13 02:12
技术资料
第一篇博文——写在前面的话
今天开始做
CC150
的题目,之前上课一直都是在用C++/C,java已经丢了好一阵子了。
僚机中的战斗机
·
2015-05-06 10:05
CC150
(Data Structures)
1.ArraysandStrings1.1boolisUniqueChars(strings) { if(s.length()>256)returnfalse; vectorvec(256,false); for(inti=0;ivec(256,0); for(inti=0;i=0;--i) { if(s[i]!='')s[m--]=s[i]; else { s[m--]='0'; s[m--]=
hz5034
·
2015-04-20 22:00
*Leetcode-Linked List Cycle
CC150
上面讲解的很清楚一快一慢赛跑的两个指针,一个每次移动两步,一个每次移动一步。假如他们相遇,那么一定存在环。
bsbcarter
·
2015-03-09 04:00
CC150
Arrays and Strings 1.7 ~ 1.8 Set Matrix Zero, IsS1RotationOfS2
1.7 WriteanalgorithmsuchthatifanelementinanMxNmatrixis0,itsentirerowandcolumnaresetto0.分析见这里解答如下:publicclassSetMatrixZero{ publicvoidSetMatrixToZero(int[][]matrix){ intheight=matrix.length; if(height=
feliciafay
·
2015-02-27 10:00
cc150
CC150
Arrays and Strings 1.4 ~ 1.6 Replace Spaces, String Compression, Rotate Image
1.4题目如下:Writeamethodtoreplaceallspacesinastringwith‘%20’.解答如下:/** *@authorfeliciafay *@notereplacespacewithPercentageSymbol *@tips1.manipulateastringfromtheend,extrabufferwillsave *ustroublefromworryi
feliciafay
·
2015-02-24 16:00
cc150
CC150
Arrays and Strings 1.1 ~ 1.3 Unique Characters, Reverse String, IsPermutation
1.1 题目如下:Implementanalgorithmtodetermineifastringhasalluniquecharacters.Whatifyoucannotuseadditionaldatastructures?解答如下:publicclassstringUniqueChar{ //askyourintervieweriftheinputstringisASCIIorUnicod
feliciafay
·
2015-02-23 15:00
FundamentalJava
cc150
:判断一棵树是否为平衡树
判断一棵树是否平衡,需要注意的是和判断一棵树是否为平衡二叉树的区别。平衡二叉树的定义为:它是一棵空树或它的左右两个子树的高度差的绝对值不超过1,并且左右两个子树都是一 棵平衡二叉树。此时指的是这棵树任意两个叶子结点到根结点的距离之差不大于1。节点定义为:structNode{ intkey; Node*lchild,*rchild,*parent; };只需要求出离根结点最近和最远的叶子结
u010893129
·
2015-02-06 20:00
struct
二叉树
平衡树
Balanced Binary Tree Leetcode Python
aheight-balancedbinarytreeisdefinedasabinarytreeinwhichthedepthofthetwosubtreesof every nodeneverdifferbymorethan1.这道题目在
CC150
hyperbolechi
·
2015-01-16 07:00
LeetCode
python
tree
#综合面经#同主题阅读:四个月骑驴找马终于结束,发面经回馈本版
就此做个总结,希望能对还在找工作的朋友们有所帮助...准备:lc(没刷完,但是有些高频题做了好几遍,还有水中的鱼的博客),
cc150
(先刷了一遍,然后又看了好几遍,反复看了书中的一些不错的解法),g4g
ChiBaoNeLiuLiuNi
·
2015-01-11 16:00
LeetCode
面试
面试准备
CC150
8.7
8.7 Givenaninfinitenumberofquarters(25cents),dimes(10cents),nickels(5cents)andpennies(1cent),writecodetocalculatethenumberofwaysofrepresentingncents.int ways(int sum, int n, int cent) // cent is maxCe
furuijie8679
·
2014-12-14 11:35
interview
CC150
9.3
9.3 Givenasortedarrayofnintegersthathasbeenrotatedanunknownnumberoftimes,giveanO(logn)algorithmthatfindsanelementinthearray.Youmayassumethatthearraywasoriginallysortedinincreasingorder.EXAMPLE:Input:f
furuijie8679
·
2014-12-14 11:57
interview
CC150
9.6
9.6 Givenamatrixinwhicheachrowandeachcolumnissorted,writeamethodtofindanelementinit.void search(int[][]a, int t) { int m = a.length; int n = a[0].length; // Start from right-up point. // if
furuijie8679
·
2014-12-14 10:29
interview
CC150
20.11
20.11 Imagineyouhaveasquarematrix,whereeachcellisfilledwitheitherblackorwhite.Designanalgorithmtofindthemaximumsubsquaresuchthatallfourbordersarefilledwithblackpixels.// A brute force solution. // n *
furuijie8679
·
2014-12-14 10:03
interview
CC150
20.9
20.9 Numbersarerandomlygeneratedandpassedtoamethod.Writeaprogramtofindandmaintainthemedianvalueasnewvaluesaregenerated.class MedianNum { // O(n) void insert(int n) { if (size == 0) {
furuijie8679
·
2014-12-12 16:58
interview
CC150
20.8
20.8 GivenastringsandanarrayofsmallerstringsT,designamethodtosearchsforeachsmallstringinT.KMPBMFancymethod.
furuijie8679
·
2014-12-12 15:57
interview
CC150
20.7
20.7 Writeaprogramtofindthelongestwordmadeofotherwordsinalistofwords.EXAMPLEInput:test,tester,testertest,testing,testingtesterOutput:testingtester// Given a list of String // Like {test, tester, teste
furuijie8679
·
2014-12-12 15:50
interview
CC150
20.6
20.6 Describeanalgorithmtofindthelargest1millionnumbersin1billionnumbers.Assumethatthecomputermemorycanholdallonebillionnumbers.// can hold all numbers. // Cheating! // Do we know the max or min? //
furuijie8679
·
2014-12-11 09:35
interview
CC150
20.5
20.5 Youhavealargetextfilecontainingwords.Givenanytwowords,findtheshortestdistance(intermsofnumberofwords)betweentheminthefile.CanyoumakethesearchingoperationinO(1)time?Whataboutthespacecomplexityfory
furuijie8679
·
2014-12-11 09:18
interview
CC150
20.4
20.4 Writeamethodtocountthenumberof2sbetween0andn.// What this mean? // Given a n. // for (int i = 0 -> n) // { // result += numOf2In(i); // } // This is purely a math problem.
furuijie8679
·
2014-12-11 09:57
interview
CC150
20.3
20.3 Writeamethodtorandomlygenerateasetofmintegersfromanarrayofsizen.Eachelementmusthaveequalprobabilityofbeingchosen.// Similar to 20.2 // This assume m <= n
furuijie8679
·
2014-12-11 03:36
interview
CC150
20.2
20.2 Writeamethodtoshuffleadeckofcards.Itmustbeaperfectshuffle-inotherwords,each52!permutationsofthedeckhastobeequallylikely.Assumethatyouaregivenarandomnumbergeneratorwhichisperfect.// Randomly gener
furuijie8679
·
2014-12-11 03:04
interview
CC150
20.1
20.1 Writeafunctionthataddstwonumbers.Youshouldnotuse+oranyarithmeticoperators.// Sorry I don't know. I hate questions like this.
furuijie8679
·
2014-12-11 03:29
interview
CC150
19.11
19.11 Designanalgorithmtofindallpairsofintegerswithinanarraywhichsumtoaspecifiedvalue. // Assume a is not null. // // a is not sorted. // // Option 1 is using a set. List> sumUpTo(int[] a, int sum) {
furuijie8679
·
2014-12-11 03:33
interview
CC150
19.10
19.10 Writeamethodtogeneratearandomnumberbetween1and7,givenamethodthatgeneratesarandomnumberbetween1and5(i.e.,implementrand7()usingrand5()). // Like a quickcheck // To generate random 7, we need at le
furuijie8679
·
2014-12-10 14:38
interview
CC150
19.8
19.8 Designamethodtofindthefrequencyofoccurrencesofanygivenwordinabook.How big the book is? split words into different smaller files: File[] files; for (String word : book.words()) { int fileIndex
furuijie8679
·
2014-12-10 14:54
interview
CC150
19.7
19.7 Youaregivenanarrayofintegers(bothpositiveandnegative).Findthecontinuoussequencewiththelargestsum.Returnthesum. // Assume a is not null. void printContinuousSequenceWithLargestSum(int[] a) { //
furuijie8679
·
2014-12-10 14:12
interview
CC150
19.5
19.5 TheGameofMasterMindisplayedasfollows:Thecomputerhasfourslotscontainingballsthatarered,yellow(Y),green(G)orblue(B).Forexample,thecomputermighthaveRGGB(e.g.,Slot#1isred,Slots#2and#3aregreen,Slot#4i
furuijie8679
·
2014-12-10 14:10
interview
CC150
19.4
19.4 Writeamethodwhichfindsthemaximumoftwonumbers.Youshouldnotuseif-elseoranyothercomparisonoperator. int max(int a, int b) { int[] temp = {a, b}; // If a > b, (a - b) >> 31 will be 0...000000;
furuijie8679
·
2014-12-10 13:52
interview
CC150
19.3
19.3 Writeanalgorithmwhichcomputesthenumberoftrailingzerosinnfactorial.int numOfZerosInNFactory(int n) { // 5 -> 1 // 10 -> 1 if (n 0) { n = n / 5; toReturn += n; } return t
furuijie8679
·
2014-12-10 13:24
interview
CC150
19.2
19.2 Designanalgorithmtofigureoutifsomeonehaswoninagameoftic-tac-toe.class TicTacToe { enum Tic { X, O } // Given TicTacToe map, wheter t has won the game. // Assume map is a not-
furuijie8679
·
2014-12-10 13:23
interview
CC150
19.1
// See http://www.hawstein.com/posts/19.1.html // 19.1 Write a function to swap a number in place without temporary variables. class CC19_1 { void swap() { int a; int b; a = a + b; b = a - b; a = a -
furuijie8679
·
2014-12-10 13:30
interview
CC150
9.5
9.5Givenasortedarrayofstringswhichisinterspersedwithemptystrings,writeamethodtofindthelocationofagivenstring.Example:find“ball”in[“at”,“”,“”,“”,“ball”,“”,“”,“car”,“”,“”,“dad”,“”,“”]willreturn4Example:
furuijie8679
·
2014-12-05 09:34
interview
Interview
CC150
9.5
9.5 Givenasortedarrayofstringswhichisinterspersedwithemptystrings,writeamethodtofindthelocationofagivenstring.Example:find“ball”in[“at”,“”,“”,“”,“ball”,“”,“”,“car”,“”,“”,“dad”,“”,“”]willreturn4Example
furuijie8679
·
2014-12-05 09:34
interview
CC150
9.4
9.4 Ifyouhavea2GBfilewithonestringperline,whichsortingalgorithmwouldyouusetosortthefileandwhy?Whatarethecommonsortingalgorithms?http://en.wikipedia.org/wiki/Sorting_algorithmMergesort,divideandconquer
furuijie8679
·
2014-12-05 09:05
interview
cc150
:将一个栈按升序排序
一、使用一个附加的栈来模拟插入排序。将原栈中的数据依次出栈与附加栈中的栈顶元素比较,如果附加栈为空,则直接将数据压栈。否则,如果附加栈的栈顶元素大于从原栈中弹出的元素,则将附加栈的栈顶元素压入原栈。一直这样查找直到附加栈为空或栈顶元素已经不大于该元素,则将该元素压入附加栈。stackSsort(stacks){ stackt; while(!s.empty()){ intdata=s.top()
u010893129
·
2014-12-05 01:00
排序
栈
cc150
CC150
9.2
9.2 Writeamethodtosortanarrayofstringssothatalltheanagramsarenexttoeachother.Useamap,thekeyissortedstring,valueislistofanagramsusingcharsinthekey.List sortByAnagrams(List strings) { Map> map; f
furuijie8679
·
2014-12-04 04:30
interview
CC150
9.1
9.1 Youaregiventwosortedarrays,AandB,andAhasalargeenoughbufferattheendtoholdB.WriteamethodtomergeBintoAinsortedorder.Option1.CreateanextrabigarrayC.iteratebothAandB.returnC.O(m+n)Option2.AssumeAisbige
furuijie8679
·
2014-12-04 03:08
interview
CC150
8.6
8.6 Implementthe“paintfill”functionthatonemightseeonmanyimageeditingprograms.Thatis,givenascreen(representedbya2dimensionalarrayofColors),apoint,andanewcolor,fillinthesurroundingareauntilyouhitaborder
furuijie8679
·
2014-12-02 10:41
interview
CC150
8.5
8.5 Implementanalgorithmtoprintallvalid(e.g.,properlyopenedandclosed)combinationsofn-pairsofparentheses.EXAMPLE:input:3(e.g.,3pairsofparentheses)output:()()(),()(()),(())(),((())) private static Se
furuijie8679
·
2014-12-02 10:18
interview
CC150
8.4
8.4 Writeamethodtocomputeallpermutationsofastring.ThisisaverysimilarquestiontoCC8.3 static Collection permutations(String s) { if (s == null || s.isEmpty()) return Collections.emptyList(); if (s.leng
furuijie8679
·
2014-12-01 14:23
interview
CC150
8.3
8.3 Writeamethodthatreturnsallsubsetsofaset.powerSet(i) = [powerSet(i - 1)] * ITEMi + // Add new item into each existing set [pwerSet(i - 1)] + // Existing set ITEMi // single new item. powerSe
furuijie8679
·
2014-12-01 14:56
interview
CC150
8.3
8.3 Writeamethodthatreturnsallsubsetsofaset.powerSet(i) = [powerSet(i - 1)] * ITEMi + // Add new item into each existing set [pwerSet(i - 1)] + // Existing set ITEMi // single new item. powerSe
furuijie8679
·
2014-12-01 06:07
interview
上一页
1
2
3
4
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他