随笔分类 - CC189
摘要:A magic index in an array A[0...n-1] is defined to be an index such that A[i] = i. Given a sorted array of distinct integers, write a method to find a
阅读全文
摘要:Imagine a robot sitting on the upper left corner of grid with r rows and c columns. The robot can only move in two directions, right and down, but cer
阅读全文
摘要:A child is running up a staircase with n steps and can hop either 1 step, 2 steps, or 3 steps at a time. Implement a method to count how many possible
阅读全文
摘要:Question:Given an M x N matrix in which each row and each column is sorted in ascending order, write a method to find an element. 1 package POJ; 2 3 ...
阅读全文
摘要:Question:Given a sorted array of strings which is interspersed with empty strings, write a method to find the location of a given string. 1 package P...
阅读全文
摘要:Question:Given a sorted array of n integers that has been rotated an unknown number of times, write code to find anelement in the array. You may assum...
阅读全文
摘要:Question:Write a method to sort an array of strings so that all the anagrams are next to each other. 1 package POJ; 2 3 import java.util.Arrays; 4 im...
阅读全文
摘要:Question:You are given two sorted arrays, A and B, where A has a large enough buffer at the end to hold B.Write a method to merge B into A in sorted o...
阅读全文
摘要:1 package POJ; 2 3 public class Main { 4 5 /** 6 * 7 * QuickSort 8 * 9 */10 public static void main(String[] args) {1...
阅读全文
摘要:1 package POJ; 2 3 public class Main { 4 5 /** 6 * 7 * MergeSort 8 * 9 */10 public static void main(String[] args) {1...
阅读全文
摘要:Reference:http://www.cnblogs.com/sujz/archive/2011/06/16/2082831.html问题:给定字符串S,生成该字符串的全排列。方法1:依次从字符串中取出一个字符作为最终排列的第一个字符,对剩余字符组成的字符串生成全排列,最终结果为取出的字符和剩余...
阅读全文
摘要:Understand limitations of floating point representations.Never check for equality with ==. Instead, check if the difference is less than an epsilon va...
阅读全文

浙公网安备 33010602011771号