随笔分类 - CC150
摘要:Describe how you could use a single array to implement three stacks.思路1:fixed divisionpackage Question3_1;import java.util.EmptyStackException;public ...
阅读全文
摘要:检测链表是否是palindrome.思路1:翻转并比较。思路2:迭代。思路3:递归。 public static boolean isPalindrome(LinkedListNode head) { LinkedListNode fast = head; Link...
阅读全文
摘要: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 ...
阅读全文
摘要:参考http://www.cnblogs.com/jdflyfly/p/3819162.html
阅读全文
摘要:Implement an algorithm to delete a node in the middle of a single linked list, given only access to that node.
阅读全文
摘要:Implement an algorithm to find the kth to last element of a singly linked list.
阅读全文
摘要:Write code to remove duplicates from an unsorted linked list.
阅读全文
摘要:Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, s1 and s2, write code to check if s2 is a rotation of s1 using only one call to isSubstring ( i.e., “waterbottle” is a rotation of “erbottlewat”).
阅读全文
摘要:Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column is set to 0.
阅读全文
摘要:Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method to rotate the image by 90 degrees. Can you do this in place?
阅读全文
摘要:Implement an method to compress the string according to the number of occurrences of each char in the string. For example, "aabcccaa" is compressed as "a2b1c3a2". If the string after the compression is not shorter, return the original string.
阅读全文
摘要:Write a method to replace all spaces in a string with ‘%20’.
阅读全文
摘要:Write a method to decide if two strings are anagrams or not.
阅读全文
摘要:Write code to reverse a C-Style String. (C-String means that “abcd” is represented as five characters, including the null character.)
阅读全文
摘要:Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures?
阅读全文

浙公网安备 33010602011771号