自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(22)
  • 收藏
  • 关注

原创 Integer/String Conversions

Integer/String ConversionsWrite two conversion routines. The first routine converts a string to a signed integer. You may assume that the string only contains digits and the minus character (‘-’),

2015-07-15 23:27:19 212

原创 Reverse Words

Reverse WordsWrite a function that reverses the order of the words in a string. For example, your function should transform the string “Do or do not, there is no try.” to “try. no is there not, do o

2015-07-13 08:10:09 230

原创 Reverse Words in a String

Reverse Words in a StringGiven an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Update (2015-02-12):For C programme

2015-07-13 07:57:13 323

原创 Remove Specified Characters

Remove Specified CharactersWrite an efficient function in JAVA that deletes characters from a string. Use the prototype string removeChars( string str, string remove ); where any character existin

2015-07-13 00:36:03 239

原创 Find the First Nonrepeated Character

Find the First Nonrepeated CharacterWrite an efficient function to find the first nonrepeated character in a string. For instance, the first nonrepeated character in “total” is ‘o’ and the first non

2015-07-12 23:44:20 306

原创 Lowest Common Ancestor of a Binary Search Tree

Lowest Common Ancestor of a Binary Search TreeGiven a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the

2015-07-12 22:58:05 258

原创 Linked List Cycle I II

Linked List CycleGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?Keep two kinds of pointers: faster pointe

2015-07-11 22:31:17 176

原创 Copy List With Random Pointer

Copy List with Random PointerA linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of th

2015-07-11 21:52:40 221

原创 Insert Interval

Insert IntervalGiven a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to th

2015-07-09 22:40:35 158

原创 Merge Intervals

Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]./** * Definition for an interval. * public class

2015-07-09 07:55:11 151

原创 Read N Characters Given Read4

The API: int read4(char *buf) reads 4 characters at a time from a file.The return value is the actual number of characters read. For example, it returns 3 if there is only 3 characters left in the

2015-07-08 23:46:57 286

原创 Largest Rectangle in Histogram

Largest Rectangle in HistogramGiven 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 histogra

2015-07-08 22:04:37 187

原创 Implement Stack Using LinkedList

import java.io.*;import java.util.*;/* * To execute Java, please define "static void main" on a class * named Solution. * * If you need more classes, simply define them inline. */interface S

2015-07-04 23:42:44 388

原创 Best Time to Buy and Sell Stock III

Best Time to Buy and Sell Stock IIISay you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may co

2015-07-04 12:00:06 254

原创 Scramble String

Scramble StringGiven a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = "grea

2015-07-04 11:20:30 394

原创 Kth Smallest Element in a BST

Kth Smallest Element in a BSTGiven a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's total e

2015-07-03 02:20:13 230

原创 Recover Binary Search Tree

Recover Binary Search TreeTwo elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n)

2015-07-02 22:09:17 253

原创 Distinct Subsequences

Distinct SubsequencesGiven a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from the origina

2015-07-01 23:23:17 203

原创 Edit Distance

Edit DistanceGiven 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 the following 3 op

2015-07-01 21:53:40 269

原创 Longest Consecutive Sequence

Longest Consecutive SequenceGiven an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest

2015-07-01 08:08:07 137

原创 N-Queens II

N-Queens IIFollow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.Please refer to the N-queens.public

2015-07-01 02:53:50 147

原创 N-Queens

N-QueensThe n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions

2015-07-01 02:28:18 168

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除