摘要:
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have t... 阅读全文
摘要:
Given a sorted array of n integers, find the starting and ending position of a given target value.If the target is not found in the array, return [-1,... 阅读全文
摘要:
Write an efficient algorithm that searches for a value in an m x n matrix, return the occurrence of it.This matrix has the following properties:Intege... 阅读全文
摘要:
Given an integer array, heapify it into a min-heap array.For a heap array A, A[0] is the root of heap, and for each A[i], A[i * 2 + 1] is the left chi... 阅读全文
摘要:
Given n unique integers, number kExampleGiven [1,2,3,4], k = 2, target = 5. Return:[ [1,4], [2,3]]public class Solution { /** * @param A: an ... 阅读全文
摘要:
Singleton is a most widely used design pattern. If a class has and only has one instance at every moment, we call this design as singleton. For exampl... 阅读全文
摘要:
Given a directed graph, design an algorithm to find out whether there is a route between two nodes.ExampleGiven graph:A----->B----->C \ | \ | ... 阅读全文
摘要:
Given k strings, find the longest common prefix (LCP).ExampleFor strings "ABCD", "ABEF" and "ACEF", the LCP is "A"For strings "ABCDEFG", "ABCEFG" and ... 阅读全文
摘要:
Given two array of integers(the first array is array A, the second array is array B), now we are going to find a element in array A which is A[i], and... 阅读全文
摘要:
Given a linked list, return the node where the cycle begins.If there is no cycle, return null.ExampleGiven -21->10->4->5, tail connects to node index ... 阅读全文