随笔分类 -  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 阅读全文
posted @ 2016-12-08 12:16 Phoebe815 阅读(342) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2016-12-08 10:39 Phoebe815 阅读(373) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2016-12-08 06:32 Phoebe815 阅读(364) 评论(0) 推荐(0)
摘要: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 ... 阅读全文
posted @ 2014-09-01 01:51 Phoebe815 阅读(250) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2014-08-23 14:09 Phoebe815 阅读(214) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2014-08-21 02:06 Phoebe815 阅读(241) 评论(1) 推荐(0)
摘要: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... 阅读全文
posted @ 2014-08-20 02:12 Phoebe815 阅读(335) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2014-08-19 22:27 Phoebe815 阅读(147) 评论(0) 推荐(0)
摘要:1 package POJ; 2 3 public class Main { 4 5 /** 6 * 7 * QuickSort 8 * 9 */10 public static void main(String[] args) {1... 阅读全文
posted @ 2014-08-19 13:38 Phoebe815 阅读(192) 评论(0) 推荐(0)
摘要:1 package POJ; 2 3 public class Main { 4 5 /** 6 * 7 * MergeSort 8 * 9 */10 public static void main(String[] args) {1... 阅读全文
posted @ 2014-08-15 20:27 Phoebe815 阅读(241) 评论(0) 推荐(0)
摘要:Reference:http://www.cnblogs.com/sujz/archive/2011/06/16/2082831.html问题:给定字符串S,生成该字符串的全排列。方法1:依次从字符串中取出一个字符作为最终排列的第一个字符,对剩余字符组成的字符串生成全排列,最终结果为取出的字符和剩余... 阅读全文
posted @ 2014-08-10 18:34 Phoebe815 阅读(434) 评论(0) 推荐(0)
摘要:Understand limitations of floating point representations.Never check for equality with ==. Instead, check if the difference is less than an epsilon va... 阅读全文
posted @ 2014-08-04 13:13 Phoebe815 阅读(143) 评论(0) 推荐(0)