摘要:
Given an array, determine whether there are three elements A[i],A[j],A[k], such that A[i]A[twoLen]) return true; 9 if (twoLen!=-1 && A[i]>... 阅读全文
摘要:
Given an array of integers, every element appears three times except for one. Find that single one. Note: We generalize this problem to: Given an arra 阅读全文
摘要:
Given an array of integers, every element appears twice except for one. Find that single one.Analysis:Use XOR operation.Solution: 1 public class Solut... 阅读全文
摘要:
There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it cost 阅读全文
摘要:
Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be o... 阅读全文
摘要:
Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating,... 阅读全文
摘要:
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the hist... 阅读全文
摘要:
Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.Solution: 1 public class Solution { 2 ... 阅读全文
摘要:
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.A better solution: 1 /** 2 * Definition for a po... 阅读全文
摘要:
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be ... 阅读全文