摘要: existing an array, check the longest continuous sub-array. what if the array has 5 million elements.class ArrayUtils { public: void checkContinue( int a[], n) { int max=-1; int count = 1; for(int i=1; i<n; i++) { if( a[i] == a[i-1] + 1 ) { count++; } else { max ... 阅读全文
posted @ 2013-01-17 13:40 西施豆腐渣 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Feb 16 '12Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-out nodes in the end should remain as it is.You may not alter the values in the nodes, only nodes itself may be changed.Only constant mem 阅读全文
posted @ 2013-01-17 04:38 西施豆腐渣 阅读(131) 评论(0) 推荐(0) 编辑