LintCode 题解
文章平均质量分 65
ActiveCoder
An active programmer
展开
-
LintCode 387. The Smallest Difference
Two Pointers, Time complexity O(N), Space O(1)#include #include #include #include using namespace std;/* Given two array of integer (A and B). Now we are going to find a element in A and ano原创 2016-05-25 10:23:19 · 304 阅读 · 0 评论 -
LintCode 49. Sort Letters by Case
Two Pointers variation #include #include using namespace std;/* Given a string which contains only letters. Sort it by lower case first and upper case second*/void sortLetters(string& letter原创 2016-05-25 10:41:10 · 218 阅读 · 0 评论 -
LintCode 143. Sort Colors II
This is a very interesting question! I like it!#include #include #include using namespace std;/* Given an array of n objects with K difference colors. sort them so that objects of the same原创 2016-05-25 11:03:14 · 285 阅读 · 0 评论 -
LintCode: Fizz Buzz
Given number n. Print number from 1 to n. But:when number is divided by 3, print "fizz".when number is divided by 5, print "buzz".when number is divided by both 3 and 5, print "fizz buzz".原创 2016-04-25 09:07:59 · 262 阅读 · 0 评论 -
Majority Element III
#include #include #include using namespace std;/* Given an array of integers and a number K, the majority number is the number that occurs more than 1/k if the size of the array. Note: ther原创 2016-06-16 23:43:59 · 248 阅读 · 0 评论 -
Delete node in BST
Question: delete the given value in BST.This question is pretty tricky, to delete a node in BST, there are several cases to consider.1: The node one of the leavesin this case, it is easy, ju原创 2016-08-06 07:04:23 · 335 阅读 · 0 评论