自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 12. Advanced Data Structure(with example problems)

0. OverviewThis time we will discuss some helpful data structures in algorithm. In many times, a good data structure could save us lots of energy, thus, besides the basic data structure vector, stack...

2020-06-18 08:05:39 492

原创 8. OOP: Smart Pointer

Smart Pointer in C++0. OverviewWe have touched the pointer in C++ previously in Linked List part. This time, we’re going to handle the smart pointer in C++. Before dig into the detail, let’s have a ...

2020-04-28 05:41:48 256

原创 7. OOP: Hash Table, Map, Priority Queue

Hash Table, Map, Priority Queue0. OverviewBesides the basic data structures mentioned in STL, there are some other interesting data structure worth being mentioned.1. Hash Table vs. Hash MapHash t...

2020-04-28 00:25:14 217

原创 6. OOP: Callable Function

Callable Function0. OverviewIt could happens sometimes that we need to pass a function as parameter to another function. However, it is weird to pass a function directly. Thus, this time we will cov...

2020-04-26 05:37:38 256

原创 11. Two Pointers(with example problems)

0. Basic Concepts0.1 Two Pointers Type?Same direction pointersFace-to-face directions1. Problem Type:1.1 Same direction pointers1.1.1 Examples:604. Window Sum vector<int> winSum(vec...

2020-04-24 10:05:47 254

原创 2. Linked List(with example problems)

Tools: Dummy NodeWhen to use:When it related to the head node, and the head node is uncertain.Tips:a. If a node->next is effected, then we need to correct this pointer.b. If the node to be d...

2020-04-20 00:26:00 335

原创 10. Depth First Search(with example problems)

0. Basic Concepts0.1 When to use DFS?When a problem need you to return all possible solutions, which can be permutation or combination, it is a must to use DFS.Time Complexity: O( # of solutions * ...

2020-04-15 12:48:35 182

原创 9. Breath First Search(with problem example)

0. Basic Concepts0.1 When to use BFS?Traversal in GraphLevel Order TraversalConnected ComponentTopological SortingShortest Path in Simple GraphLimited to the simple graph, which means no ...

2020-04-15 01:03:17 319

原创 4.Binary Tree(with example problem)

0. Basic Concepts0.1 Binary TreeAt the depth of i, the number of nodes is 2^(i-1) at most.For a tree whose depth is k, the number of nodes is 2^(k-1) at most0.2 Full Binary TreeThe binary tree ...

2020-04-11 07:14:13 389

原创 8. Binary Search(with example problems)

1. Binary Search ProblemThis kind of problem are usually:Given an sorted integer array - nums, and an integer - target.Find the any/first/last position of target in numsReturn -1 if target does n...

2020-04-01 05:01:41 300

原创 5. OOP: Initialization

Initialization0. OverviewIt a simple concept distinguish: what default constructor, constructor with values, and initializer_list.1. default < constructor < initializer_listWhen we create a ...

2020-03-09 04:49:12 178

原创 4. OOP: Operator Overloading

Operator Overloading0. OverviewWe have some clue of package < iostream> now. However, for now, we could only do the operator based on default data type, such as int, char. What if we want to d...

2020-03-09 04:10:58 212

原创 1.Array & String (with example problems)

Array & String加粗样式Tools: string functions in C++These functions are frequently used in algorithm solution, for more details and functions, refer to this.// Searches the string for the first oc...

2020-02-18 07:26:24 201

原创 1360. Symmetric Tree

1360. Symmetric TreeDescription:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).ExampleExample1Input: {1,2,2,3,4,4,3}Output: trueExplanation:1/ ...

2020-02-02 05:03:49 138

原创 189. First Missing Positive

[Problem Name](probelm link/description)Description:Given an unsorted integer array, find the first missing positive integer.ExampleExample 1:Input:[1,2,0]Output:3Example 2:Input:[3,4,-1,1]Ou...

2020-02-01 02:18:28 183

原创 50. Product of Array Exclude Itself

50. Product of Array Exclude ItselfDescription:Given an integers array A.Define B[i] = A[0] * … * A[i-1] * A[i+1] * … * A[n-1], calculate B WITHOUT divide operation.Out put BExampleExample 1Inpu...

2020-02-01 02:09:34 140

原创 56. Two Sum

56. Two SumDescription:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add...

2020-02-01 01:56:09 145

原创 64. Merge Sorted Array

64. Merge Sorted ArrayDescription:Given two sorted integer arrays A and B, merge B into A as one sorted array.ExampleExample 1:Input:[1, 2, 3] 3 [4,5] 2Output:[1,2,3,4,5]Explanation:After me...

2020-01-31 05:58:44 150

原创 100. Remove Duplicates from Sorted Array

100. Remove Duplicates from Sorted ArrayDescription:Given a sorted array, ‘remove’ the duplicates in place such that each element appear only once and return the ‘new’ length.Do not allocate extra ...

2020-01-31 05:46:57 128

原创 138. Subarray Sum

138. Subarray SumDescription:Given an integer array, find a subarray where the sum of numbers is zero. Your code should return the index of the first number and the index of the last number.Example...

2020-01-31 05:41:58 196

原创 172. Remove Element

172. Remove ElementDescription:Given an array and a value, remove all occurrences of that value in place and return the new length.The order of elements can be changed, and the elements after the n...

2020-01-30 07:41:15 163

原创 78. Longest Common Prefix

78. Longest Common PrefixDescription:Given k strings, find the longest common prefix (LCP).ExampleExample 1:Input: “ABCD”, “ABEF”, “ACEF”Output: “A”Example 2:Input: “ABCDEFG”, “ABCEFG” and “...

2020-01-30 07:34:51 157 1

原创 79. Longest Common Substring

79. Longest Common SubstringDescription:Given two strings, find the longest common substring.Return the length of it.ExampleExample 1:Input: “ABCD” and “CBCE”Output: 2Explanation:Longest co...

2020-01-30 07:28:31 224

原创 5. Study Note of Object Oriented Programming (OOP): STL II

STL With OverloadingOverview:In this section, we did not discuss new STL data type. But we covered three ways of initializing data member of a class: default constructor, constructor with values, an...

2020-01-29 11:39:39 166

原创 13. Implement strStr()

13. Implement strStr()Tag:StringDescription:For a given source string and a target string, you should output the first index(from 0) of target string in source string.If target does not exist in ...

2020-01-25 15:53:46 142

原创 55. Compare Strings / 158. Valid Anagram

55. Compare Strings / 158. Valid AnagramTag:Hash Table, MapDescription:55. Compare StringsCompare two strings A and B, determine whether A contains all of the characters in B.The characters in s...

2020-01-25 15:37:17 1453 1

原创 4. OOP: STL(vector, list, map)

STL(vector, list, map)Overview:STL is the soul of C++. Remember this, mastering the STL is master the most part of C++. Though array is more efficient than vector, vector is still the feature of C++...

2020-01-25 15:25:44 265 1

原创 452. Remove Linked List Elements

452. Remove Linked List ElementsDescription:Remove all elements from a linked list of integers that have value val.ExampleExample 1:Input: head = 1->2->3->3->4->5->3->null, v...

2020-01-24 05:03:51 152

原创 4.Study Note of Object Oriented Programming (OOP):Operator Overloading

Operator OverloadingOverview:This chapter discuss about the operator overloading in C++. It is common used component in C++ programming. Personally speaking, the most used operator overloading is th...

2020-01-24 02:00:15 222

原创 167. Add Two Numbers

167. Add Two NumbersDescription:You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order, such that the 1’s digit is at the ...

2020-01-22 05:40:44 216

原创 223. Palindrome Linked List

35. Reverse Linked ListDescription:Implement a function to check if a linked list is a palindrome.ExampleExample 1:Input: 1->2->1output: trueExample 2:Input: 2->2->1output: false...

2020-01-21 14:11:31 178

原创 104. Merge K Sorted Lists

104. Merge K Sorted ListsDescription:Merge k sorted linked lists and return it as one sorted list.Analyze and describe its complexity.ExampleExample 1:Input: [2->4->null,null,-1->null...

2020-01-21 08:57:40 229

原创 165. Merge Two Sorted Lists

165. Merge Two Sorted ListsDescription:Merge two sorted (ascending) linked lists and return it as a new sorted list. The new sorted list should be made by splicing together the nodes of the two list...

2020-01-21 07:07:17 140

原创 380. Intersection of Two Linked Lists

380. Intersection of Two Linked ListsDescription:Write a program to find the node at which the intersection of two singly linked lists begins.ExampleExample 1:Input:A: a1 → a2↘c1 → c2...

2020-01-21 07:03:43 144

原创 105. Copy List with Random Pointer

35. Reverse Linked ListDescription:A 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 the list....

2020-01-21 06:38:59 162

原创 35. Reverse Linked List

35. Reverse Linked ListDescription:Reverse a linked list.ExampleExample 1:Input: 1->2->3->nullOutput: 3->2->1->nullExample 2:Input: 1->2->3->4->nullOutput: 4-&gt...

2020-01-20 17:29:18 186

原创 Wiggle Sort I/II

508. Wiggle SortTag:Main Idea:Problem Type.State:Update Function:Initialization:Answer:Tips/Notes:Time/Space Cost:Time Cost:  O(n)\ O(n) O(n)Space Cost:  O(1)\ O(1)...

2020-01-19 12:55:46 179

原创 5. Kth Largest Element

5. Kth Largest ElementTag:Main Idea:It’s not recommended to sort the array, because it’s time-costing.State:Update Function:Initialization:Answer:Tips/Notes:Time/Space Cost:Time Co...

2020-01-19 07:23:30 198

原创 Continuous Subarray Sum I/II

402. Continuous Subarray SumsTag:Main Idea:Problem Type.State:Update Function:Initialization:Answer:Tips/Notes:Time/Space Cost:Time Cost:  O(n)\ O(n) O(n)Space Cost: &nb...

2020-01-19 06:04:22 197

原创 3. OOP: Linked List

Linked List1. OverviewToday’s topic is Linked List. The code structure would be: class Node, class LinkedList, definitions of functions of LinkedList, and Main() function.Linked list was mentioned...

2020-01-18 13:52:35 190

空空如也

空空如也

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

TA关注的人

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