摘要:
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the 阅读全文
摘要:
Partition an integers array into odd number first and even number second. Given [1, 2, 3, 4], return [1, 3, 2, 4] public class Solution { /** * @param 阅读全文
摘要:
Using O(1) time to check whether an integer n is a power of 2. For n=4, return true; For n=5, return false; 这道题就是看一下这个int二进制各位上总共是否只有一个1,如果只有一个1则是2的n次 阅读全文
摘要:
Given a boolean 2D matrix, find the number of islands. Given graph: [ [1, 1, 0, 0, 0], [0, 1, 0, 0, 1], [0, 0, 0, 1, 1], [0, 0, 0, 0, 0], [0, 0, 0, 0, 阅读全文
摘要:
Find the nth to last element of a singly linked list. The minimum number of nodes in list is n. Given a List 3->2->1->5->null and n = 2, return node w 阅读全文
摘要:
Given an array of integers, find the subarray with smallest sum. Return the sum of the subarray. For [1, -1, -2, 1], return -3 这道题就是把Maximum Subarray反 阅读全文
摘要:
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 阅读全文