Internship Recruiting

I currently have several intern openings for deep learning and computer vision. 


This is an internship for both research and development. 



You will have opportunities to publish high level papers in computer vision and deep learning, or develop cool real world AI application if you prefer more for coding!  



If you have experiences in deep learning and computer vision, and interested in this intern, please send me your resume by email (xperzy AT gmail DOT com) with subject "CV intern". 




Please refer to this link for my personal webpage for my info.  (xperzy.github.io)

LeetCode Online Judge Questions Table

Leetcode (Finished)

# Title Difficulty Keyword
307 Range Sum Query - Mmutable Medium Segment Tree
304 Range Sum Query 2D - Immutable Medium DP
303 Range Sum Query - Immutable Easy DP
301 Remove Invalid Parentheses Hard
300 Longest Increasing Subsequence Medium DP
299 Bulls and Cows Easy Hash Map
297 Serialize and Deserialize Binary Tree Hard Tree Travsersal
295 Find Median from Data Stream Hard Heap
292 Nim Game Easy
290 Word Pattern Easy Hash
289 Game of Life Meduim Array
287 Find the Duplicate Number Hard Two Pointers, Linked list
284 Peeking Iterator Medium Design
283 Moving Zeros Easy two pointers
282 Expression Add Operators Hard DFS, String
279 Perfect Squares Medium BFS, DP
278 First Bad Version Easy binary search
275 H-Index II Medium binary search
274 H-Index Medium
273 Integer to English Words Hard String
268 Missing Number Medium
264 Ugly Number II Medium
263 Ugly Number Easy
260 Single Number III Medium
258 Add Digits Easy
257 Binary Tree Paths Easy
242 Valid Anagram Easy
241 Different Ways to Add Parentheses Medium
240 Search a 2D Matrix II Medium
239 Sliding Window Maximum Hard
238 Product of Array Except Self Medium
237 Delete Node in a Linked List Easy
236 Lowest Common Ancestor of a Binary Tree Medium
235 Lowest Common Ancestor of a Binary Search Tree Easy
234 Palindrome Linked List Easy
233 Number of Digit One Hard
232 Implement Queue using Stacks Easy
231 Power of Two Easy
230 Kth Smallest Element in a BST Medium
229 Majority Element II Medium
228 Summary Ranges Medium
227 Basic Calculator II Medium
226 Invert Binary Tree Easy
225 Implement Stack using Queues Easy
224 Basic Calculator Hard
223 Rectangle Area Easy
222 Count Complete Tree Nodes Medium
221 Maximal Square Medium
220 Contains Duplicate III Medium
219 Contains Duplicate II Easy
218 The Skyline Problem Hard
217 Contains Duplicate Easy
216 Combination Sum III Medium
215 Kth Largest Element in an Array Medium
214 Shortest Palindrome Hard
213 House Robber II Medium DP
212 Word Search II Hard
211 Add and Search Word - Data structure design Medium
210 Course Schedule II Medium
209 Minimum Size Subarray Sum Medium
208 Implement Trie (Prefix Tree) Medium
207 Course Schedule Medium
206 Reverse Linked List Easy
205 Isomorphic Strings Easy
204 Count Primes Easy
203 Remove Linked List Elements Easy
202 Happy Number Easy
201 Bitwise AND of Numbers Range Medium
200 Number of Islands Medium
199 Binary Tree Right Side View Medium
198 House Robber Easy
191 Number of 1 Bits Easy
190 Reverse Bits Easy
189 Rotate Array Easy
188 Best Time to Buy and Sell Stock IV Hard
187 Repeated DNA Sequences Medium
179 Largest Number Medium
174 Dungeon Game Hard
173 Binary Search Tree Iterator Medium
172 Factorial Trailing Zeroes Easy
171 Excel Sheet Column Number Easy
169 Majority Element Easy
168 Excel Sheet Column Title Easy
167 Two Sum II - Input array is sorted Medium
166 Fraction to Recurring Decimal Medium
165 Compare Version Numbers Easy
164 Maximum Gap Hard
162 Find Peak Element Medium
160 Intersection of Two Linked Lists Easy
155 Min Stack Easy
154 Find Minimum in Rotated Sorted Array II Hard
153 Find Minimum in Rotated Sorted Array Medium
152 Maximum Product Subarray Medium
151 Reverse Words in a String Medium
150 Evaluate Reverse Polish Notation Medium
149 Max Points on a Line Hard
148 Sort List Medium
147 Insertion Sort List Medium
146 LRU Cache Hard
145 Binary Tree Postorder Traversal Hard
144 Binary Tree Preorder Traversal Medium
143 Reorder List Medium
142 Linked List Cycle II Medium
141 Linked List Cycle Easy
140 Word Break II Hard
139 Word Break Medium
138 Copy List with Random Pointer Hard
137 Single Number II Medium
136 Single Number Easy
135 Candy Hard
134 Gas Station Medium
133 Clone Graph Medium
132 Palindrome Partitioning II Hard
131 Palindrome Partitioning Medium
130 Surrounded Regions Medium
129 Sum Root to Leaf Numbers Medium
128 Longest Consecutive Sequence Hard
127 Word Ladder Medium
126 Word Ladder II Hard
125 Valid Palindrome Easy
124 Binary Tree Maximum Path Sum Hard
123 Best Time to Buy and Sell Stock III Hard
122 Best Time to Buy and Sell Stock II Medium
121 Best Time to Buy and Sell Stock Easy
120 Triangle Medium
119 Pascal's Triangle II Easy
118 Pascal's Triangle Easy
117 Populating Next Right Pointers in Each Node II Hard
116 Populating Next Right Pointers in Each Node Medium
115 Distinct Subsequences Hard
114 Flatten Binary Tree to Linked List Medium
113 Path Sum II Medium
112 Path Sum Easy
111 Minimum Depth of Binary Tree Easy
110 Balanced Binary Tree Easy
109 Convert Sorted List to Binary Search Tree Medium
108 Convert Sorted Array to Binary Search Tree Medium
107 Binary Tree Level Order Traversal II Easy
106 Construct Binary Tree from Inorder and Postorder Traversal Medium
105 Construct Binary Tree from Preorder and Inorder Traversal Medium
104 Maximum Depth of Binary Tree Easy
103 Binary Tree Zigzag Level Order Traversal Medium
102 Binary Tree Level Order Traversal Easy
101 Symmetric Tree Easy
100 Same Tree Easy
99 Recover Binary Search Tree Hard
98 Validate Binary Search Tree Medium
97 Interleaving String Hard
96 Unique Binary Search Trees Medium
95 Unique Binary Search Trees II Medium
94 Binary Tree Inorder Traversal Medium
93 Restore IP Addresses Medium
92 Reverse Linked List II Medium
91 Decode Ways Medium
90 Subsets II Medium
89 Gray Code Medium
88 Merge Sorted Array Easy
87 Scramble String Hard
86 Partition List Medium
85 Maximal Rectangle Hard
84 Largest Rectangle in Histogram Hard
83 Remove Duplicates from Sorted List Easy
82 Remove Duplicates from Sorted List II Medium
81 Search in Rotated Sorted Array II Medium
80 Remove Duplicates from Sorted Array II Medium
79 Word Search Medium
78 Subsets Medium
77 Combinations Medium
76 Minimum Window Substring Hard
75 Sort Colors Medium
74 Search a 2D Matrix Medium
73 Set Matrix Zeroes Medium
72 Edit Distance Hard
71 Simplify Path Medium
70 Climbing Stairs Easy
69 Sqrt(x) Medium
68 Text Justification Hard
67 Add Binary Easy
66 Plus One Easy
65 Valid Number Hard
64 Minimum Path Sum Medium
63 Unique Paths II Medium
62 Unique Paths Medium
61 Rotate List Medium
60 Permutation Sequence Medium
59 Spiral Matrix II Medium
58 Length of Last Word Easy
57 Insert Interval Hard
56 Merge Intervals Hard
55 Jump Game Medium
54 Spiral Matrix Medium
53 Maximum Subarray Medium
52 N-Queens II Hard
51 N-Queens Hard
50 Pow(x, n) Medium
49 Group Anagrams Medium
48 Rotate Image Medium
47 Permutations II Medium
46 Permutations Medium
45 Jump Game II Hard
44 Wildcard Matching Hard
43 Multiply Strings Medium
42 Trapping Rain Water Hard
41 First Missing Positive Hard
40 Combination Sum II Medium
39 Combination Sum Medium
38 Count and Say Easy
37 Sudoku Solver Hard
36 Valid Sudoku Easy
35 Search Insert Position Medium
34 Search for a Range Medium
33 Search in Rotated Sorted Array Hard
32 Longest Valid Parentheses Hard
31 Next Permutation Medium
30 Substring with Concatenation of All Words Hard
29 Divide Two Integers Medium
28 Implement strStr() Easy
27 Remove Element Easy
26 Remove Duplicates from Sorted Array Easy
25 Reverse Nodes in k-Group Hard
24 Swap Nodes in Pairs Easy
23 Merge k Sorted Lists Hard
22 Generate Parentheses Medium
21 Merge Two Sorted Lists Easy
20 Valid Parentheses Easy
19 Remove Nth Node From End of List Easy
18 4Sum Medium
17 Letter Combinations of a Phone Number Medium
16 3Sum Closest Medium
15 3Sum Medium
14 Longest Common Prefix Easy
13 Roman to Integer Easy
12 Integer to Roman Medium
11 Container With Most Water Medium
10 Regular Expression Matching Hard
9 Palindrome Number Easy
8 String to Integer (atoi) Easy
7 Reverse Integer Easy
6 ZigZag Conversion Easy
5 Longest Palindromic Substring Medium
4 Median of Two Sorted Arrays Hard
3 Longest Substring Without Repeating Characters Medium
2 Add Two Numbers Medium
1 Two Sum Easy Hash Map

leetCode Question: Additive Number

Additive Number

Additive number is a string whose digits can form additive sequence.

A valid additive sequence should contain at least three numbers. Except for the first two numbers, each subsequent number in the sequence must be the sum of the preceding two.

For example:
"112358" is an additive number because the digits can form an additive sequence: 1, 1, 2, 3, 5, 8.

1 + 1 = 2, 1 + 2 = 3, 2 + 3 = 5, 3 + 5 = 8
"199100199" is also an additive number, the additive sequence is: 1, 99, 100, 199.
1 + 99 = 100, 99 + 100 = 199
Note: Numbers in the additive sequence cannot have leading zeros, so sequence 1, 2, 03 or 1, 02, 3 is invalid.

Given a string containing only digits '0'-'9', write a function to determine if it's an additive number.

Analysis
For this question, the first thing we could handle is

  • How to determine the sum of two strings in int is equal to the other string in int?

I use the string manipulation to handle the case when the number is too larger to be stored in an long long type (in cpp). This is implemented in the checkEQ function shown in my code below. Note that, the question is not allowed to use "03", "02", ect format, we also have to eliminte such cases (by the if condition in Line 6 below). In my implementation, the swap operation is to make the longer number always stores in a. The Line 5 is to ignore the check if the two numbers a and c are totally different, regarding to the fact that the sum of two numbers will not exceede the max length of two numbers + 1.
E.g., a = 998, b = 80, c = a + b = 998 + 80 = 1078
The length of c will never be greater than length of a + 1, since the carry will never greater than 1. Using this properties of sum operation, we could easily implement the following code for checking the sum of three strings as shown in checkEQ function. DO NOT forget to check the last carry!

Next we are facing the main part of the problem: find a way to check the whole string. I will show how I handle this in a clear way (which may not be optimal but quite easy to understand).

From the problem we know that:

  • The length of each number could be different.
  • At least we should have 3 numbers, which forms the whole string.
  • If we find one match (a + b = c), we shall keep searching (b + c = ???)
  • If our search goes to the end of the number, we could return True.

These observations tell us that:

  • We could check each possible length of each number
  • The max length of first number is length of string - 2, the max length of second number is length of string - length of 1st number - 1.
  • We could use a recursion to do this search, since every time, the procedure is almost same, but the input data are different.
  • The termination condition of our recursion is whether we match the whole string.

Given these infomation, we could implement our recursion function, which is shown in my code below:

Code (C++):

class Solution {
public:
bool checkEQ(string a, string b, string c){
if (a.size() < b.size()){ a.swap(b); }
if (c.size()- a.size() > 2){ return false;}
if ((a[0] == '0' && a.size()>1)|| (b[0]=='0'&&b.size()>1)){return false;}
int i = a.size()-1;
int j = b.size()-1;
string s ="";
int carry = 0;
while (j>=0){
int tmp = ( int(a[i]-char('0')) + int(b[j]-char('0')) + carry );
s.insert(0, 1,char(tmp % 10 + '0'));
carry = tmp / 10;
i--;
j--;
}
while (i>=0){
int tmp = (int(a[i]-char('0')) + carry );
s.insert(0,1,char(tmp % 10 + '0'));
carry = tmp / 10;
i--;
}
if (carry > 0){ s = "1" + s; };
return s.compare(c)==0;
}
void search(string prev1, string prev2, string num, bool& res){
if (res == true){ return; }
if (num == ""){
res = true;
}else{
int sz = num.size();
if (prev1 == ""){
for (int i=1;i<=sz-2;i++){
prev1 = num.substr(0, i);
search(prev1, prev2, num.substr(i),res);
}
}
if (prev2 == ""){
for (int i=1;i<=sz-1;i++){
prev2 = num.substr(0, i);
search(prev1, prev2, num.substr(i),res);
}
}
for (int i=1;i<=sz;i++){
if (checkEQ(prev1, prev2, num.substr(0,i))==true){
search(prev2, num.substr(0,i), num.substr(i),res);
}
}
}
}
bool isAdditiveNumber(string num) {
string prev1 = "";
string prev2 = "";
bool res = false;
search(prev1, prev2, num, res);
return res;
}
};

Code(Python):

class Solution(object):
def checkEQ(self, a, b, c):
if a == "" or b == "":
return False
if a[0] == '0' and len(a) > 1 or b[0] == '0' and len(b) > 1:
return False
if len(a) < len(b):
a, b = b, a
if len(c) - len(a) > 2:
return False
i = len(a)-1
j = len(b)-1
s = ""
carry = 0
while j >=0:
tmp = int(a[i]) + int(b[j]) + carry
s = str(tmp%10) + s
carry = tmp / 10
i -= 1
j -= 1
while i >=0:
tmp = int(a[i]) + carry
s = str(tmp%10) + s
carry = tmp / 10
i -= 1
if carry == 1 :
s = "1" + s
return s == c
def search(self, prev1, prev2, num, res):
if res[0]:
return
if num == "":
res[0] = True
else:
if prev1 == "":
for i in xrange(1, len(num)-1):
self.search(num[0:i], prev2, num[i::], res)
elif prev2 == "":
for i in xrange(1, len(num)):
self.search(prev1, num[0:i], num[i::], res)
else:
for i in xrange(1, len(num)+1):
if self.checkEQ(prev1, prev2, num[0:i]):
self.search(prev2, num[0:i], num[i::], res)
def isAdditiveNumber(self, num):
"""
:type num: str
:rtype: bool
"""
prev1 = ""
prev2 = ""
current = ""
if len(num) < 3:
return False
res = [False]
self.search(prev1, prev2, num, res)
return res[0]