From 8363d61d43bd280813be416ec205fe4db9888243 Mon Sep 17 00:00:00 2001 From: Heva Date: Sun, 27 Nov 2016 19:51:35 -0500 Subject: [PATCH] Add files via upload --- Summary_Ranges.cpp | 88 +++++++++ Surrounded_Regions.cpp | 143 ++++++++++++++ Switch_statements.java | 101 ++++++++++ Symmetric_tree.cpp | 94 +++++++++ Tag_Content_Extractor.js | 73 +++++++ The_Love_Letter_Mystery.js | 63 ++++++ The_Skyline_Problem.js | 130 +++++++++++++ The_Utopian_Tree.js | 81 ++++++++ The_connected_cell_in_a_grid.js | 104 ++++++++++ Trapping_Rain_Water.cpp | 92 +++++++++ Two_Sum.cpp | 69 +++++++ Two_Sum_2_Input_Array_is_Sorted.cpp | 67 +++++++ UTF_8_Validation.cpp | 96 +++++++++ Ugly_Number.cpp | 11 ++ Unique_Binary_Search_Trees.cpp | 62 ++++++ Unique_Binary_Search_Trees_2.cpp | 112 +++++++++++ Unique_Word_Abbreviation.cpp | 104 ++++++++++ Valid_Anagram.cpp | 68 +++++++ Valid_Palindrome.cpp | 14 ++ Valid_Parentheses.cpp | 77 ++++++++ Valid_Sudoku.cpp | 33 ++++ Valid_Username_Checker.js | 66 +++++++ Validate_Binary_Search_Tree.cpp | 82 ++++++++ Walls_and_Gates.cpp | 106 ++++++++++ Welcome_to_java.cpp | 10 + Wiggle_Sort.cpp | 73 +++++++ Wiggle_Sort_2.cpp | 72 +++++++ Wiggle_Subsequence.cpp | 111 +++++++++++ Wildcard_Matching.cpp | 163 ++++++++++++++++ Word_Break.cpp | 61 ++++++ Word_Break_2.cpp | 92 +++++++++ Word_Ladder_2.cpp | 291 ++++++++++++++++++++++++++++ Word_Pattern.cpp | 80 ++++++++ Word_Search_2.cpp | 186 ++++++++++++++++++ ZigZag_Iterator.cpp | 105 ++++++++++ Zigzag_Conversion.cpp | 58 ++++++ template_strings.java | 173 +++++++++++++++++ test.cpp | 73 +++++++ test.exe | Bin 0 -> 95649 bytes unordered_map.cpp | 43 ++++ variables.java | 25 +++ 41 files changed, 3552 insertions(+) create mode 100644 Summary_Ranges.cpp create mode 100644 Surrounded_Regions.cpp create mode 100644 Switch_statements.java create mode 100644 Symmetric_tree.cpp create mode 100644 Tag_Content_Extractor.js create mode 100644 The_Love_Letter_Mystery.js create mode 100644 The_Skyline_Problem.js create mode 100644 The_Utopian_Tree.js create mode 100644 The_connected_cell_in_a_grid.js create mode 100644 Trapping_Rain_Water.cpp create mode 100644 Two_Sum.cpp create mode 100644 Two_Sum_2_Input_Array_is_Sorted.cpp create mode 100644 UTF_8_Validation.cpp create mode 100644 Ugly_Number.cpp create mode 100644 Unique_Binary_Search_Trees.cpp create mode 100644 Unique_Binary_Search_Trees_2.cpp create mode 100644 Unique_Word_Abbreviation.cpp create mode 100644 Valid_Anagram.cpp create mode 100644 Valid_Palindrome.cpp create mode 100644 Valid_Parentheses.cpp create mode 100644 Valid_Sudoku.cpp create mode 100644 Valid_Username_Checker.js create mode 100644 Validate_Binary_Search_Tree.cpp create mode 100644 Walls_and_Gates.cpp create mode 100644 Welcome_to_java.cpp create mode 100644 Wiggle_Sort.cpp create mode 100644 Wiggle_Sort_2.cpp create mode 100644 Wiggle_Subsequence.cpp create mode 100644 Wildcard_Matching.cpp create mode 100644 Word_Break.cpp create mode 100644 Word_Break_2.cpp create mode 100644 Word_Ladder_2.cpp create mode 100644 Word_Pattern.cpp create mode 100644 Word_Search_2.cpp create mode 100644 ZigZag_Iterator.cpp create mode 100644 Zigzag_Conversion.cpp create mode 100644 template_strings.java create mode 100644 test.cpp create mode 100644 test.exe create mode 100644 unordered_map.cpp create mode 100644 variables.java diff --git a/Summary_Ranges.cpp b/Summary_Ranges.cpp new file mode 100644 index 0000000..9c482f2 --- /dev/null +++ b/Summary_Ranges.cpp @@ -0,0 +1,88 @@ +/*228. Summary Ranges QuestionEditorial Solution My Submissions +Total Accepted: 58494 Total Submissions: 219243 Difficulty: Medium +Given a sorted integer array without duplicates, return the summary of its ranges. + +For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"]. + +Credits: +Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases. + +Hide Company Tags Google +Hide Tags Array +Hide Similar Problems (M) Missing Ranges (H) Data Stream as Disjoint Intervals +*/ + + + + +/*for each element, initialize the step as 1 +check how large it can range, and put this range into the ret array*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +class Solution { +public: + vector summaryRanges(vector& nums) { + vector ret; + int i = 0; + int n = nums.size(); + while(i"+to_string(nums[i+j-1])); //remember -1, before is ++j + i += j; + } + + return ret; + } +}; + +class Solution { +public: + vector summaryRanges(vector& nums) { + int nsize = nums.size(); + vector nrange; //the vector is a string vector + + for(int i = 0; i < nsize;){ + int start = i, end = i; + while(end+1 start) nrange.push_back(to_string(nums[start])+"->"+to_string(nums[end])); //nums[start] not start + else nrange.push_back(to_string(nums[start])); + i = end +1; //through this to control the next value + } + return nrange; + } +}; + + + + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class Solution { + public List summaryRanges(int[] nums) { + List ret = new ArrayList<>(); + if(nums==null || nums.length==0) return ret; + + int i = 0; + int n = nums.length; + while(i"+Integer.toString(nums[i+j-1])); + /*if(step>=2){ + ret.add(Integer.toString(nums[start]) + "->" + + Integer.toString(nums[start+step-1])); + } else if(step==1){ + ret.add(Integer.toString(nums[start])); + }*/ + i += j; + } + + return ret; + } +} \ No newline at end of file diff --git a/Surrounded_Regions.cpp b/Surrounded_Regions.cpp new file mode 100644 index 0000000..b5da81b --- /dev/null +++ b/Surrounded_Regions.cpp @@ -0,0 +1,143 @@ +/*130. Surrounded Regions QuestionEditorial Solution My Submissions +Total Accepted: 60534 +Total Submissions: 362069 +Difficulty: Medium +Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'. + +A region is captured by flipping all 'O's into 'X's in that surrounded region. + +For example, +X X X X +X O O X +X X O X +X O X X +After running your function, the board should be: + +X X X X +X X X X +X X X X +X O X X +Subscribe to see which companies asked this question + +Show Tags +Show Similar Problems +*/ + + +/*First, check the four border of the matrix. If there is a element is +'O', alter it and all its neighbor 'O' elements to '1'. +Then ,alter all the 'O' to 'X' +At last,alter all the '1' to 'O'*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +class Solution { +public: + void solve(vector>& board) { + int i, j; + int row = board.size(); + if(!row){ + return; + } + + int col = board[0].size(); + for(i = 0; i < row; i++){ + check(board, i, 0, row, col); + if(col>1){ + check(board, i, col-1, row, col); + } + } + + for(j = 1; j + 1 < col; j++){ + check(board, 0, j, row, col); + if(row>1){ + check(board, row-1, j, row, col); + } + } + + for(i = 0; i < row; i++){ + for(j = 0; j < col; j++){ + if(board[i][j] == 'O'){ + board[i][j] = 'X'; + } + } + } + + for(i = 0; i < row; i++){ + for(j = 0; j < col; j++){ + if(board[i][j] == '1'){ + board[i][j] = 'O'; + } + } + } + } + + void check(vector > &board, int i, int j, int row, int col){ + if(board[i][j]=='O'){ + board[i][j] = '1'; + if(i>1) check(board, i-1, j, row, col); + if(j>1) check(board, i, j-1, row, col); + if(i+11){ + check(board, i, col-1, row, col); + } + } + + for(j = 1; j + 1 < col; j++){ + check(board, 0, j, row, col); + if(row>1){ + check(board, row-1, j, row, col); + } + } + + for(i = 0; i < row; i++){ + for(j = 0; j < col; j++){ + if(board[i][j] == 'O'){ + board[i][j] = 'X'; + } + } + } + + for(i = 0; i < row; i++){ + for(j = 0; j < col; j++){ + if(board[i][j] == '1'){ + board[i][j] = 'O'; + } + } + } + } + + public void check(char[][] board, int i, int j, int row, int col){ + if(board[i][j] == 'O'){ + board[i][j] = '1'; + if(i>1) check(board, i-1, j, row, col); + if(j>1) check(board, i, j-1, row, col); + if(i+1 read more on how binary tree is serialized on OJ. +*/ + + + +/*BFS +Search the left node and right node at the same time +recursively check the node*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +/** + * Definition for a binary tree node. + * struct TreeNode { + * int val; + * TreeNode *left; + * TreeNode *right; + * TreeNode(int x) : val(x), left(NULL), right(NULL) {} + * }; + */ +class Solution { +public: + bool isSymmetric(TreeNode* root) { + if(!root) return true; + return CheckSymmetric(root->left, root->right); + } + + bool CheckSymmetric(TreeNode* lNode, TreeNode* rNode){ + if(!lNode && !rNode) return true; //both child is NULL, true + else if(!lNode || !rNode) return false; //if there is only one child is NULL, should return false + + if(lNode->val != rNode->val) return false; + return CheckSymmetric(lNode->left, rNode->right) && CheckSymmetric(lNode->right, rNode->left); + } +}; + + + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +/** + * Definition for a binary tree node. + * public class TreeNode { + * int val; + * TreeNode left; + * TreeNode right; + * TreeNode(int x) { val = x; } + * } + */ +public class Solution { + public boolean isSymmetric(TreeNode root) { + if(root == null){ + return true; + } + + return CheckSymmetric(root.left, root.right); + } + + public boolean CheckSymmetric(TreeNode left, TreeNode right){ + if(left==null && right==null){ + return true; + } else if(left==null || right==null){ + return false; + } + + if(left.val != right.val){ + return false; + } + + return CheckSymmetric(left.left,right.right) && CheckSymmetric(left.right, right.left); + } +} \ No newline at end of file diff --git a/Tag_Content_Extractor.js b/Tag_Content_Extractor.js new file mode 100644 index 0000000..82d2a94 --- /dev/null +++ b/Tag_Content_Extractor.js @@ -0,0 +1,73 @@ +/* +In a tag-based language like XML or HTML, contents are enclosed between a start tag and an end tag like contents. Note that the corresponding end tag starts with a /. + +Given a string of text in a tag-based language, parse this text and retrieve the contents enclosed within sequences of well-organized tags meeting the following criterion: + +The name of the start and end tags must be same. The HTML code

Hello World

is not valid, because the text starts with an h1 tag and ends with a non-matching h2 tag. + +Tags can be nested, but content between nested tags is considered not valid. For example, in

contentsinvalid

, contents is valid but invalid is not valid. + +Tags can consist of any printable characters. + +Input Format + +The first line of input contains a single integer, NN (the number of lines). +The NN subsequent lines each contain a line of text. + +Constraints + +1≤N≤1001≤N≤100 +Each line contains a maximum of 104104 printable characters. +The total number of characters in all test cases will not exceed 106106. +Output Format + +For each line, print the content enclosed within valid tags. +If a line contains multiple instances of valid content, print out each instance of valid content on a new line; if no valid content is found, print None. + +Sample Input + +4 +

Nayeem loves counseling

+

Sanjay has no watch

So wait for a while +safat codes like a ninja +Imtiaz has a secret crush +Sample Output + +Nayeem loves counseling +Sanjay has no watch +So wait for a while +None +Imtiaz has a secret crush +*/ + +import java.io.*; +import java.util.*; +import java.text.*; +import java.math.*; +import java.util.regex.*; + +public class Solution{ + public static void main(String[] args){ + + Scanner in = new Scanner(System.in); + int testCases = Integer.parseInt(in.nextLine()); + while(testCases>0){ + String line = in.nextLine(); + + //Write your code here + int count = 0; + Pattern r = Pattern.compile("<(.+?)>([^<>]+)"); + Matcher m = r.matcher(line); + while(m.find()){ + if (m.group(2).length()!=0){ + System.out.println(m.group(2)); + count++; + } + } + if(count==0) + System.out.println("None"); + + testCases--; + } + } +} diff --git a/The_Love_Letter_Mystery.js b/The_Love_Letter_Mystery.js new file mode 100644 index 0000000..d877cd2 --- /dev/null +++ b/The_Love_Letter_Mystery.js @@ -0,0 +1,63 @@ +/* +James找到了他的朋友Harry要给女朋友的情书。James很爱恶作剧,所以他决定要胡搞一下。他把信中的每个单字都变成了回文。对任何给定的字符串,他可以减少其中任何一个字符的值,例如'd'可以变成'c',这算是一次操作。(另外,他最多只能将字符的值减少至'a','a'不能再被减少成'z')。找出将给定字符串转换成回文所需的最少操作次数。 + + +输入格式 +第一行包含整数 T 代表测试数据的组数。 +接着 T 行各包含一个字符串。 + +输出格式 +每个测试数据各输出一行,代表此数据需要的最少操作次数。 + +取值范围 +1 ≤ T ≤ 10 +1 ≤ 字符串长度 ≤ 104 + +样例输入 #00 + +3 +abc +abcba +abcd +样例输出 #00 + +2 +0 +4 +样例解析 + +第一组数据:ab*c* -> ab*b* -> ab*a*。 +第二组数据:abcba本身已经是回文了。 +第三组数据:abc*d* -> abc*c* -> abc*b* -> abc*a* = ab*c*a -> ab*b*a。 +*/ + +function processData(input) { + //Enter your code here + var data = input.split('\n'); + //var nsize = data[0]; + var nsize = parseInt(data[0]); + for(var i = 1; i <= nsize; i++){ + var count = 0; + var current_string = data[i]; //var current_string=input.split('\n')[i+1]; + var len = current_string.length-1; + var slen = 0; + while(slen <= len){ + count += Math.abs(current_string.charCodeAt(len)-current_string.charCodeAt(slen)); + slen++; + len--; + } + console.log(count); + } + +} + +process.stdin.resume(); +process.stdin.setEncoding("ascii"); +_input = ""; +process.stdin.on("data", function (input) { + _input += input; +}); + +process.stdin.on("end", function () { + processData(_input); +}); diff --git a/The_Skyline_Problem.js b/The_Skyline_Problem.js new file mode 100644 index 0000000..05089e1 --- /dev/null +++ b/The_Skyline_Problem.js @@ -0,0 +1,130 @@ +/* +A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. Now suppose you are given the locations and height of all the buildings as shown on a cityscape photo (Figure A), write a program to output the skyline formed by these buildings collectively (Figure B). + + Buildings Skyline Contour +The geometric information of each building is represented by a triplet of integers [Li, Ri, Hi], where Li and Ri are the x coordinates of the left and right edge of the ith building, respectively, and Hi is its height. It is guaranteed that 0 ≤ Li, Ri ≤ INT_MAX, 0 < Hi ≤ INT_MAX, and Ri - Li > 0. You may assume all buildings are perfect rectangles grounded on an absolutely flat surface at height 0. + +For instance, the dimensions of all buildings in Figure A are recorded as: [ [2 9 10], [3 7 15], [5 12 12], [15 20 10], [19 24 8] ] . + +The output is a list of "key points" (red dots in Figure B) in the format of [ [x1,y1], [x2, y2], [x3, y3], ... ] that uniquely defines a skyline. A key point is the left endpoint of a horizontal line segment. Note that the last key point, where the rightmost building ends, is merely used to mark the termination of the skyline, and always has zero height. Also, the ground in between any two adjacent buildings should be considered part of the skyline contour. + +For instance, the skyline in Figure B should be represented as:[ [2 10], [3 15], [7 12], [12 0], [15 10], [20 8], [24, 0] ]. + +Notes: + +The number of buildings in any input list is guaranteed to be in the range [0, 10000]. +The input list is already sorted in ascending order by the left x position Li. +The output list must be sorted by the x position. +There must be no consecutive horizontal lines of equal height in the output skyline. For instance, [...[2 3], [4 5], [7 5], [11 5], [12 7]...] is not acceptable; the three lines of height 5 should be merged into one in the final output as such: [...[2 3], [4 5], [12 7], ...] + +Credits: +Special thanks to @stellari for adding this problem, creating these two awesome images and all test cases. + +Hide Company Tags Microsoft Google Facebook Twitter Yelp +Hide Tags Binary Indexed Tree Segment Tree Heap Divide and Conquer +*/ + + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////// +//C++ +class Solution { +public: + vector> getSkyline(vector>& buildings) { + multimap heights; + for(const vector &b:buildings){ + heights.emplace(b[0],b[2]); + heights.emplace(b[1],-b[2]); + } + + multiset hset = {0}; + vector > heightMap; + int x = -1; + int y = 0; + for(const pair h:heights){ + if((x>=0) && (h.first!=x) && (heightMap.empty() || (heightMap.rbegin()->second != y))){ + heightMap.emplace_back(x,y); + } + + if(h.second>=0){ + hset.insert(h.second); + }else{ + hset.erase(hset.find(-h.second)); + } + + x = h.first; + y = *hset.rbegin(); + } + + if(!heightMap.empty()){ + heightMap.emplace_back(x,0); + } + + return heightMap; + } +}; + + + + + +/*use heights = arraylist to store the buildings +push into the list, set the left side as negative one, set the right side as positive one +sort the heights according to their position +for each h in heights + if it is the left side of the building, push it into heightMap + else minus the correspond building key + use heightMap.firstKey() to get the curr height + if it is not equal to pre one, add it into skyLine list + +*/ + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class Solution { + public List getSkyline(int[][] buildings) { + List skyLine = new ArrayList<>(); + if(buildings==null ||buildings.length==0 || buildings[0].length==0) return skyLine; + + List heights = new ArrayList<>(); + for(int[] b:buildings){ + heights.add(new int[]{b[0],-b[2]}); //set new int[] + heights.add(new int[]{b[1],b[2]}); + } + + Collections.sort(heights, (a,b) -> (a[0]==b[0] ? a[1]-b[1] : a[0]-b[0])); + //TreeMap can sorted the elements + //key is the height of building's left side + //value is how many buildings has this left side + TreeMap heightMap = new TreeMap<>(Collections.reverseOrder()); + heightMap.put(0,1); + + int preHeight = 0; + for(int[] h:heights){ + if(h[1] < 0){ + //this is the left side of one building + Integer cur = heightMap.get(-h[1]); //use Integer not int, we need to compare it with null + cur = (cur==null ? 1 : cur+1); + heightMap.put(-h[1],cur); + } else { + //this is the right side of the building + Integer cur = heightMap.get(h[1]); + if(cur==1){//only one building has this value, remove this building from map + heightMap.remove(h[1]); + } else { + heightMap.put(h[1], cur-1); + } + } + int curHeight = heightMap.firstKey(); //use firstKey() to get the lowest key in heightMap, since we initialize reverseOrder(), this return the largest key + if(curHeight != preHeight){ + skyLine.add(new int[]{h[0],curHeight}); + preHeight = curHeight; + } + } + + return skyLine; + } +} \ No newline at end of file diff --git a/The_Utopian_Tree.js b/The_Utopian_Tree.js new file mode 100644 index 0000000..b128382 --- /dev/null +++ b/The_Utopian_Tree.js @@ -0,0 +1,81 @@ +/* +The Utopian Tree goes through 2 cycles of growth every year. Each spring, it doubles in height. Each summer, its height increases by 1 meter. + +Laura plants a Utopian Tree sapling with a height of 1 meter at the onset of spring. How tall will her tree be after NN growth cycles? + +Input Format + +The first line contains an integer, TT, the number of test cases. +TT subsequent lines each contain an integer, NN, denoting the number of cycles for that test case. + +Constraints +1≤T≤101≤T≤10 +0≤N≤600≤N≤60 +Output Format + +For each test case, print the height of the Utopian Tree after NN cycles. Each height must be printed on a new line. + +Sample Input + +3 +0 +1 +4 +Sample Output + +1 +2 +7 +Explanation + +There are 3 test cases. + +In the first case (N=0N=0), the initial height (H=1H=1) of the tree remains unchanged. + +In the second case (N=1N=1), the tree doubles in height and is 22 meters tall after the spring cycle. + +In the third case (N=4N=4), the tree doubles its height in spring (H=2H=2), then grows a meter in summer (H=3H=3), then doubles after the next spring (H=6H=6), and grows another meter after summer (H=7H=7). Thus, at the end of 4 cycles, its height is 77 meters. +*/ + +process.stdin.resume(); +process.stdin.setEncoding('ascii'); + +var input_stdin = ""; +var input_stdin_array = ""; +var input_currentline = 0; + +process.stdin.on('data', function (data) { + input_stdin += data; +}); + +process.stdin.on('end', function () { + input_stdin_array = input_stdin.split("\n"); + main(); +}); + +function readLine() { + return input_stdin_array[input_currentline++]; +} + +/////////////// ignore above this line //////////////////// + +function main() { + var t = parseInt(readLine()); + var initialHeight = 1; + var height = initialHeight; + for(var a0 = 0; a0 < t; a0++){ + var n = parseInt(readLine()); + if(n == 0) console.log(initialHeight); + else{ + height = initialHeight; + for(var a1 = 1; a1 <= n; a1++){ + if(a1%2 == 1) height = 2 * height; + else if(a1%2 == 0) height = height + 1; + }; + console.log(height); + } + } + + + +} \ No newline at end of file diff --git a/The_connected_cell_in_a_grid.js b/The_connected_cell_in_a_grid.js new file mode 100644 index 0000000..6075d1c --- /dev/null +++ b/The_connected_cell_in_a_grid.js @@ -0,0 +1,104 @@ +/* +You are given a matrix with mm rows and nn columns of cells, each of which contains either 11 or 00. Two cells are said to be connected if they are adjacent to each other horizontally, vertically, or diagonally. The connected and filled (i.e. cells that contain a 11) cells form a region. There may be several regions in the matrix. Find the number of cells in the largest region in the matrix. + +Input Format +There will be three parts of t input: +The first line will contain mm, the number of rows in the matrix. +The second line will contain nn, the number of columns in the matrix. +This will be followed by the matrix grid: the list of numbers that make up the matrix. + +Output Format +Print the length of the largest region in the given matrix. + +Constraints +0 0){ + arr.push(inputData[n].split(' ')); + n++; + } + + var counts = new Array(); + for(var i = 0; i < nrows; i++){ + for(var j = 0; j < ncols; j++) + counts.push(region(i, j, nrows, ncols, arr)); + } + + var maxcounts = counts[0]; + for(i = 0; i < counts.length; i++){ + if(counts[i]>maxcounts) maxcounts = counts[i]; + } + //console.log(counts); + console.log(maxcounts); +} + +function region(irow, icol, nrows, ncols, arr) +{ + if(irow >= nrows) irow = nrows-1; + if(icol >= ncols) icol = ncols-1; + if(irow < 0) irow = 0; + if(icol < 0) icol = 0; + var count = 0; + var arrele = arr[irow][icol]; + if(arrele == 8) return 0; //we have already count this region + if(arrele == 0) return 0; //it is not region + if(arrele == 1){//choose the next region + count++; + arr[irow][icol] = 8; + count += region(irow+1, icol, nrows, ncols, arr); + count += region(irow-1, icol, nrows, ncols, arr); + count += region(irow, icol+1, nrows, ncols, arr); + count += region(irow, icol-1, nrows, ncols, arr); + count += region(irow+1, icol+1, nrows, ncols, arr); + count += region(irow+1, icol-1, nrows, ncols, arr); + count += region(irow-1, icol+1, nrows, ncols, arr); + count += region(irow-1, icol-1, nrows, ncols, arr); + } + return count; +} + + +process.stdin.resume(); +process.stdin.setEncoding("ascii"); +_input = ""; +process.stdin.on("data", function (input) { + _input += input; +}); + +process.stdin.on("end", function () { + processData(_input); +}); + + diff --git a/Trapping_Rain_Water.cpp b/Trapping_Rain_Water.cpp new file mode 100644 index 0000000..516ec0d --- /dev/null +++ b/Trapping_Rain_Water.cpp @@ -0,0 +1,92 @@ +/*42. Trapping Rain Water QuestionEditorial Solution My Submissions +Total Accepted: 83168 Total Submissions: 243044 Difficulty: Hard +Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. + +For example, +Given [0,1,0,2,1,0,1,3,2,1,2,1], return 6. + + +The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain water (blue section) are being trapped. Thanks Marcos for contributing this image! + +Hide Company Tags Google Twitter Zenefits Amazon Apple Bloomberg +Hide Tags Array Stack Two Pointers +Hide Similar Problems (M) Container With Most Water (M) Product of Array Except Self (H) Trapping Rain Water II +*/ + + + +/*O(n) time, O(1) space +Two Pointers, +one for left, one for right, +try to find the maxL and maxR seperately +compare A[left] and A[right] +if A[left]<=A[right] + if A[left]>=maxL, update maxL, otherwise, add the ret water + left++ +otherwise, compare A[right] and maxR, similarly to right side, and right--*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +class Solution { +public: + int trap(vector& height) { + int left = 0, right = height.size()-1; + if(height.size()<=1) return 0; + int ret = 0; + int maxL = 0, maxR = 0; + while(left <= right){ + if(height[left] <= height[right]){ + //check left side, + if(height[left] >= maxL){ + maxL = height[left]; + } else { + ret += maxL-height[left]; + } + left++; + } else { + //check right side + if(height[right] >= maxR){ + maxR = height[right]; + } else { + ret += maxR-height[right]; + } + right--; + } + } + return ret; + } +}; + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class Solution { + public int trap(int[] height) { + if(height==null || height.length==0) return 0; + int left = 0, right = height.length-1; + int ret = 0; + int maxL = 0, maxR = 0; + while(left <= right){ + if(height[left] <= height[right]) { + //check left side + if(height[left] >= maxL) { + maxL = height[left]; + } else { + ret += maxL-height[left]; + } + left++; //remember left++ + } else { + //check the right side + if(height[right] >= maxR) { + maxR = height[right]; + } else { + ret += maxR-height[right]; + } + right--;// remember right-- + } + } + return ret; + } +} diff --git a/Two_Sum.cpp b/Two_Sum.cpp new file mode 100644 index 0000000..643b060 --- /dev/null +++ b/Two_Sum.cpp @@ -0,0 +1,69 @@ +/*1. Two Sum QuestionEditorial Solution My Submissions +Total Accepted: 330110 Total Submissions: 1188061 Difficulty: Easy Contributors: Admin +Given an array of integers, return indices of the two numbers such that they add up to a specific target. + +You may assume that each input would have exactly one solution. + +Example: +Given nums = [2, 7, 11, 15], target = 9, + +Because nums[0] + nums[1] = 2 + 7 = 9, +return [0, 1]. +UPDATE (2016/2/13): +The return format had been changed to zero-based indices. Please read the above updated description carefully. + +Hide Company Tags LinkedIn Uber Airbnb Facebook Amazon Microsoft Apple Yahoo Dropbox Bloomberg Yelp Adobe +Hide Tags Array Hash Table +Hide Similar Problems (M) 3Sum (M) 4Sum (M) Two Sum II - Input array is sorted (E) Two Sum III - Data structure design +*/ + + + +/* +use hashmap to store the value in array, and their correspond index +for search, check if target-curvalue is exist in map, +if it is, return their index*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +class Solution { +public: + vector twoSum(vector& nums, int target) { + //Key is the number and value is its index in the vector. + unordered_map hash; + vector result; + for (int i = 0; i < nums.size(); i++) { + int numberToFind = target - nums[i]; + + //if numberToFind is found in map, return them + if (hash.find(numberToFind) != hash.end()) { + result.push_back(hash[numberToFind] ); + result.push_back(i); + return result; + } + + //number was not found. Put it in the map. + hash[nums[i]] = i; + } + return result; + } +}; + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class Solution { + public int[] twoSum(int[] nums, int target) { + Map mymap = new HashMap<>(); + for(int i = 0; i < nums.length; ++i){ + int n1 = target-nums[i]; + if(mymap.containsKey(n1)){ + return new int[]{mymap.get(n1), i}; + } + mymap.put(nums[i],i); + } + return new int[]{-1,-1}; + } +} diff --git a/Two_Sum_2_Input_Array_is_Sorted.cpp b/Two_Sum_2_Input_Array_is_Sorted.cpp new file mode 100644 index 0000000..04d1b82 --- /dev/null +++ b/Two_Sum_2_Input_Array_is_Sorted.cpp @@ -0,0 +1,67 @@ +/*167. Two Sum II - Input array is sorted QuestionEditorial Solution My Submissions +Total Accepted: 32791 Total Submissions: 68140 Difficulty: Medium Contributors: Admin +Given an array of integers that is already sorted in ascending order, 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 up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 and index2) are not zero-based. + +You may assume that each input would have exactly one solution. + +Input: numbers={2, 7, 11, 15}, target=9 +Output: index1=1, index2=2 + +Hide Company Tags Amazon +Hide Tags Array Two Pointers Binary Search +Hide Similar Problems (E) Two Sum +*/ + + + +/* O(n) +since it is already sorted, we use two pointers + one at start, and another one start from the end + each time move two pointers + if larger than target, move the back pointer + if less than target, move the forward poitner*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +class Solution { +public: + vector twoSum(vector& numbers, int target) { + int lo=0, hi=numbers.size()-1; + while (numbers[lo]+numbers[hi]!=target){ + if (numbers[lo]+numbers[hi]({lo+1,hi+1}); + } +}; + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class Solution { + public int[] twoSum(int[] numbers, int target) { + int left = 0; + int right = numbers.length - 1; + + while(left <= right){ + int sum = numbers[left] + numbers[right]; + if(sum > target){ + //move the right pointer to make sum smaller + right--; + } else if (sum < target){ + left++; + } else { + //sum == target + break; + } + } + return new int[]{left+1, right+1}; + } +} diff --git a/UTF_8_Validation.cpp b/UTF_8_Validation.cpp new file mode 100644 index 0000000..5402eea --- /dev/null +++ b/UTF_8_Validation.cpp @@ -0,0 +1,96 @@ +/*393. UTF-8 Validation QuestionEditorial Solution My Submissions +Total Accepted: 546 +Total Submissions: 2431 +Difficulty: Medium +A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules: + +For 1-byte character, the first bit is a 0, followed by its unicode code. +For n-bytes character, the first n-bits are all one's, the n+1 bit is 0, followed by n-1 bytes with most significant 2 bits being 10. +This is how the UTF-8 encoding would work: + + Char. number range | UTF-8 octet sequence + (hexadecimal) | (binary) + --------------------+--------------------------------------------- + 0000 0000-0000 007F | 0xxxxxxx + 0000 0080-0000 07FF | 110xxxxx 10xxxxxx + 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx + 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx +Given an array of integers representing the data, return whether it is a valid utf-8 encoding. + +Note: +The input is an array of integers. Only the least significant 8 bits of each integer is used to store the data. This means each integer represents only 1 byte of data. + +Example 1: + +data = [197, 130, 1], which represents the octet sequence: 11000101 10000010 00000001. + +Return true. +It is a valid utf-8 encoding for a 2-bytes character followed by a 1-byte character. +Example 2: + +data = [235, 140, 4], which represented the octet sequence: 11101011 10001100 00000100. + +Return false. +The first 3 bits are all one's and the 4th bit is 0 means it is a 3-bytes character. +The next byte is a continuation byte which starts with 10 and that's correct. +But the second continuation byte does not start with 10, so it is invalid. +Hide Company Tags Google +Hide Tags Bit Manipulation +*/ + + + +/*seperately check the start of the number, using a count to control the last n-1 numbers +if (d>>5)==0b110, this number should be 2 bytes character ,count = 1 +if (d>>4)==0b1110, this number should be 3 bytes character ,count = 2 +if (d>>3)==0b11110, this number should be 4 bytes character ,count = 3 +if (d>>7)==0, this number should be 1 bytes character +then check the last n-1 numbers +when count!=0, means we need to continue check if it is a perfect characer number + if (d>>6)!=0b10, this number is not perfect, return false + else count--. check the next number, until count==0 +*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +class Solution { +public: + bool validUtf8(vector& data) { + int count = 0; + for(auto d: data){ + if(count==0){ + if((d>>5)==0b110) count = 1; + else if((d>>4)==0b1110) count = 2; + else if((d>>3)==0b11110) count = 3; + else if((d>>7)) return false; + } else { + if((d>>6)!=0b10) return false; + count--; + } + } + return !count; //check if count == 0 + } +}; + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class Solution { + public boolean validUtf8(int[] data) { + int count = 0;//help check which bytes are this number + for(int d:data){ + if(count==0){ + if((d>>5)==0b110) count = 1; //2 bytes + else if((d>>4)==0b1110) count = 2; //3 bytes + else if((d>>3)==0b11110) count = 3;//4 bytes + else if((d>>7)!=0) return false; //not 1 bytes, remember != + } else { + if((d>>6)!=0b10) return false; + count--; + } + } + return count==0; + } +} \ No newline at end of file diff --git a/Ugly_Number.cpp b/Ugly_Number.cpp new file mode 100644 index 0000000..2999b2d --- /dev/null +++ b/Ugly_Number.cpp @@ -0,0 +1,11 @@ +class Solution { +public: + bool isUgly(int num) { + for(int i = 2; i < 6 && num; i++) + { + while(num%i == 0) + num /= i; + } + return num == 1; + } +}; \ No newline at end of file diff --git a/Unique_Binary_Search_Trees.cpp b/Unique_Binary_Search_Trees.cpp new file mode 100644 index 0000000..eae7dd8 --- /dev/null +++ b/Unique_Binary_Search_Trees.cpp @@ -0,0 +1,62 @@ +/*96. Unique Binary Search Trees QuestionEditorial Solution My Submissions +Total Accepted: 93941 +Total Submissions: 242894 +Difficulty: Medium +Given n, how many structurally unique BST's (binary search trees) that store values 1...n? + +For example, +Given n = 3, there are a total of 5 unique BST's. + + 1 3 3 2 1 + \ / / / \ \ + 3 2 1 1 3 2 + / / \ \ + 2 1 2 3 +Subscribe to see which companies asked this question*/ + + + +/*DP dynamic programming +define two functions +G(n): the number of unique BST for the sequence of length n +F(i,n), 1<=i<=n: i is the root of BST, sequence ranges from 1 to n +G(n) = F(1, n) + F(2, n) + ... + F(n, n). +G(0)=1, G(1)=1. +F(i, n) = G(i-1) * G(n-i) 1 <= i <= n +G(n) = G(0) * G(n-1) + G(1) * G(n-2) + … + G(n-1) * G(0) */ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +class Solution { +public: + int numTrees(int n) { + vector G(n+1); + G[0] = 1; + G[1] = 1; + for(int i = 2; i <= n; ++i){ //start from 2 + for(int j = 1; j <= i; ++j){ //start from 1 + G[i] += G[j-1] * G[i-j]; //remember(+=) + } + } + return G[n]; + } +}; + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class Solution { + public int numTrees(int n) { + int[] G = new int[n+1]; + G[0] = 1; + G[1] = 1; + for(int i = 2; i <= n; ++i){ + for(int j = 1; j <= i; ++j){ + G[i] += G[j-1]*G[i-j]; + } + } + return G[n]; + } +} \ No newline at end of file diff --git a/Unique_Binary_Search_Trees_2.cpp b/Unique_Binary_Search_Trees_2.cpp new file mode 100644 index 0000000..dbebe94 --- /dev/null +++ b/Unique_Binary_Search_Trees_2.cpp @@ -0,0 +1,112 @@ +/*95. Unique Binary Search Trees II QuestionEditorial Solution My Submissions +Total Accepted: 63260 +Total Submissions: 212899 +Difficulty: Medium +Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n. + +For example, +Given n = 3, your program should return all 5 unique BST's shown below. + + 1 3 3 2 1 + \ / / / \ \ + 3 2 1 1 3 2 + / / \ \ + 2 1 2 3 +Subscribe to see which companies asked this question*/ + + +/*DP*/ +/*1...n is the in-order traversal for BST +pick i-th node as the root, the elements i to (i-1) should be the left node +the element (i+1) to n should be the right node +recursively do this +*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +/** + * Definition for a binary tree node. + * struct TreeNode { + * int val; + * TreeNode *left; + * TreeNode *right; + * TreeNode(int x) : val(x), left(NULL), right(NULL) {} + * }; + */ +class Solution { +public: + vector generateTrees(int n) { + if(n==0){ + return vector(); + } + return buildTree(1, n); + } + + vector buildTree(int start, int end){ + vector ret; + if(start>end){ + ret.push_back(NULL); + } + + vector left, right; + for(int i = start; i <= end; ++i){ + left = buildTree(start, i-1); + right = buildTree(i+1, end); + for(TreeNode* l:left){ + for(TreeNode* r:right){ + TreeNode* root = new TreeNode(i); + root->left = l; + root->right = r; + ret.push_back(root); + } + } + } + + return ret; + } +}; + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +/** + * Definition for a binary tree node. + * public class TreeNode { + * int val; + * TreeNode left; + * TreeNode right; + * TreeNode(int x) { val = x; } + * } + */ +public class Solution { + public List generateTrees(int n) { + if(n==0){ + return (new LinkedList()); + } + return buildTree(1,n); + } + + public List buildTree(int start, int end){ + List ret = new LinkedList<>(); + if(start > end){ + ret.add(null); + } + + for(int i = start; i <= end; ++i){ + List left = buildTree(start, i-1); + List right = buildTree(i+1, end); + for(TreeNode l:left){ + for(TreeNode r:right){ + TreeNode root = new TreeNode(i); + root.left = l; + root.right = r; + ret.add(root); + } + } + } + + return ret; + } +} \ No newline at end of file diff --git a/Unique_Word_Abbreviation.cpp b/Unique_Word_Abbreviation.cpp new file mode 100644 index 0000000..f65d590 --- /dev/null +++ b/Unique_Word_Abbreviation.cpp @@ -0,0 +1,104 @@ +/*288. Unique Word Abbreviation QuestionEditorial Solution My Submissions +Total Accepted: 15926 +Total Submissions: 102353 +Difficulty: Easy +An abbreviation of a word follows the form . Below are some examples of word abbreviations: + +a) it --> it (no abbreviation) + + 1 +b) d|o|g --> d1g + + 1 1 1 + 1---5----0----5--8 +c) i|nternationalizatio|n --> i18n + + 1 + 1---5----0 +d) l|ocalizatio|n --> l10n +Assume you have a dictionary and given a word, find whether its abbreviation is unique in the dictionary. A word's abbreviation is unique if no other word from the dictionary has the same abbreviation. + +Example: +Given dictionary = [ "deer", "door", "cake", "card" ] + +isUnique("dear") -> false +isUnique("cart") -> true +isUnique("cane") -> false +isUnique("make") -> true +Hide Company Tags Google +Hide Tags Hash Table Design +Hide Similar Problems (E) Two Sum III - Data structure design (M) Generalized Abbreviation +*/ + + + +/*Use unordered_map to store the unique word +for isUnique, just check if this abbreviation exist*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +class ValidWordAbbr { + private: + unordered_map> mymap; +public: + ValidWordAbbr(vector &dictionary) { + for(string s:dictionary){ + int n = s.size(); + string newString = s[0] + to_string(n) + s[n-1]; + mymap[newString].insert(s); + } + } + + bool isUnique(string word) { + int n = word.size(); + string newString = word[0] + to_string(n) + word[n-1]; + return mymap[newString].count(word) == mymap[newString].size(); + } +}; + + +// Your ValidWordAbbr object will be instantiated and called as such: +// ValidWordAbbr vwa(dictionary); +// vwa.isUnique("hello"); +// vwa.isUnique("anotherWord"); + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class ValidWordAbbr { + private HashMap> mymap; + + public ValidWordAbbr(String[] dictionary) { + mymap = new HashMap>(); + for(String s:dictionary){ + String newString = getKey(s); + //if s is already inserted, check if it is equal + if(!mymap.containsKey(newString)){ + mymap.put(newString, new HashSet()); + } + mymap.get(newString).add(s); + // System.out.println(mymap.get(newString) + " " + newString); + } + } + + public boolean isUnique(String word) { + String newString = getKey(word); + // System.out.println(newString + " " + mymap.containsKey(newString)); + return !mymap.containsKey(newString) || + (mymap.get(newString).size()==1 && mymap.get(newString).contains(word)); + } + + public String getKey(String s){ + if(s.length() <=2 ) return s; + int n = s.length(); + return s.charAt(0) + Integer.toString(n-2) + s.charAt(n-1); + } +} + + +// Your ValidWordAbbr object will be instantiated and called as such: +// ValidWordAbbr vwa = new ValidWordAbbr(dictionary); +// vwa.isUnique("Word"); +// vwa.isUnique("anotherWord"); diff --git a/Valid_Anagram.cpp b/Valid_Anagram.cpp new file mode 100644 index 0000000..9a4d6e0 --- /dev/null +++ b/Valid_Anagram.cpp @@ -0,0 +1,68 @@ +/*242. Valid Anagram QuestionEditorial Solution My Submissions +Total Accepted: 107559 +Total Submissions: 246357 +Difficulty: Easy +Given two strings s and t, write a function to determine if t is an anagram of s. + +For example, +s = "anagram", t = "nagaram", return true. +s = "rat", t = "car", return false. + +Note: +You may assume the string contains only lowercase alphabets. + +Follow up: +What if the inputs contain unicode characters? How would you adapt your solution to such case? + +Subscribe to see which companies asked this question*/ + + + +/*use an extra array to store the count of each alphabet in string s and string t +one insert, one delete, if there are some count of element is not 0, return false +else return true*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +class Solution { +public: + bool isAnagram(string s, string t) { + if(s.length() != t.length()) return false; + vector snum(26,0); + for(int i = 0; i < s.length(); i++) + { + snum[s[i]-'a']++; + snum[t[i]-'a']--; + } + for(int i = 0; i < snum.size(); i++) + { + if(snum[i]) return false; + } + return true; + } +}; + + + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class Solution { + public boolean isAnagram(String s, String t) { + int[] temp = new int[26]; + if(s.length() != t.length()) return false; + + for(int i = 0; i < s.length(); ++i){ + temp[s.charAt(i)-'a']++; //use charAt to get the char + temp[t.charAt(i)-'a']--; + } + + for(int i:temp){ + if(i!=0) return false; + } + + return true; + } +} \ No newline at end of file diff --git a/Valid_Palindrome.cpp b/Valid_Palindrome.cpp new file mode 100644 index 0000000..355c85c --- /dev/null +++ b/Valid_Palindrome.cpp @@ -0,0 +1,14 @@ +#include //toupper & isalnum + +class Solution { +public: + bool isPalindrome(string s) { + for(int i = 0, j = s.size()-1; i < j; i++, j--) + { + while(!isalnum(s[i]) && (i s1; + + for(char c:s){ + if(c=='(' || c=='{' || c=='[') s1.push(c); + else if(c==')' && !s1.empty() && s1.top()=='(') s1.pop(); + else if(c=='}' && !s1.empty() && s1.top()=='{') s1.pop(); + else if(c==']' && !s1.empty() && s1.top()=='[') s1.pop(); + else return false; + } + + return s1.empty(); + } +}; + +class Solution { +public: + bool isValid(string s) { + stack s1; + for(char &c : s){ + switch(c){ + case '(': //s1.push(c); break; + case '{': //s1.push(c); break; + case '[': s1.push(c); break; + case ')': if(s1.empty() || s1.top()!='(') return false; else s1.pop(); break; + case '}': if(s1.empty() || s1.top()!='{') return false; else s1.pop(); break; + case ']': if(s1.empty() || s1.top()!='[') return false; else s1.pop(); break; + default: ; + } + } + return s1.empty(); + } +}; + + + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class Solution { + public boolean isValid(String s) { + Stack s1 = new Stack<>(); + for(char c:s.toCharArray()){ + if(c=='(' || c=='{' || c=='[' ) s1.push(c); + else if(c==')' && !s1.empty() && s1.peek()=='(') s1.pop(); //remember !empty + else if(c=='}' && !s1.empty() && s1.peek()=='{') s1.pop(); + else if(c==']' && !s1.empty() && s1.peek()=='[') s1.pop(); + else return false; //need to return false like []} situation + } + + return s1.empty(); + } +} \ No newline at end of file diff --git a/Valid_Sudoku.cpp b/Valid_Sudoku.cpp new file mode 100644 index 0000000..6edb8e3 --- /dev/null +++ b/Valid_Sudoku.cpp @@ -0,0 +1,33 @@ +/* +Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. + +The Sudoku board could be partially filled, where empty cells are filled with the character '.'. + + +A partially filled sudoku which is valid. +*/ + +class Solution { +public: + bool isValidSudoku(vector>& board) { + vector > rboard(9, vector(9,0)); //control the rows + vector > cboard(9, vector(9,0)); //control the columns + vector > subboard(9, vector(9,0));//control the subboards + + for(int i = 0; i < board.size(); i++){ + for(int j = 0; j < board[i].size(); j++){ + if(board[i][j] != '.'){ + int num = board[i][j] - '0' - 1; + int k = i / 3 * 3 + j / 3; //control the position of the subboards + + if(rboard[i][num] || cboard[j][num] || subboard[k][num]) //check if this number has occur + return false; + + rboard[i][num] = cboard[j][num] = subboard[k][num] = 1; + } + } + } + + return true; + } +}; \ No newline at end of file diff --git a/Valid_Username_Checker.js b/Valid_Username_Checker.js new file mode 100644 index 0000000..aa7e1f7 --- /dev/null +++ b/Valid_Username_Checker.js @@ -0,0 +1,66 @@ +/* +Regular expressions (regexpregexp) help us match or search for patterns in strings. In this problem, you will be given a username. Your task is to check whether that username is valid. A valid username will have the following properties: + +The username can contain alphanumeric characters and/or underscores(_). +The username must start with an alphabetic character. +8 ≤≤ |Username| ≤≤ 30. +To simplify your task, we have provided a portion of the code in the editor. You just need to write down the regexregex pattern which will be used to validate the username input. + +Input Format + +The first line of input contains an integer NN, representing the number of testcases. Each of the next NN lines contains a string that represents a username. + +Constraints + +The username consists of any printable characters. +1≤N≤1001≤N≤100 +Output Format + +For each username, output Valid if the username is valid; otherwise, output Invalid. + +Sample Input + +4 +alpha_naheed +xahidbuffon +nagib@007 +123Swakkhar +Sample Output + +Valid +Valid +Invalid +Invalid +Explanation + +The first two cases fulfill the constraints of a valid username. The third case is invalid because it contains an invalid character '@'. The fourth case is also invalid because it starts with a numeric character. +*/ + +import java.io.*; +import java.util.*; +import java.text.*; +import java.math.*; +import java.util.regex.*; + +public class Solution { + public static void main(String[] args){ + Scanner in = new Scanner(System.in); + int testCases = Integer.parseInt(in.nextLine()); + while(testCases>0){ + String username = in.nextLine(); + //String pattern = Complete this line in the editable area below + + String pattern = "^[A-Za-z][A-Za-z0-9_]{7,29}$";//~~Write your pattern here~~; + + Pattern r = Pattern.compile(pattern); + Matcher m = r.matcher(username); + + if (m.find( )) { + System.out.println("Valid"); + } else { + System.out.println("Invalid"); + } + testCases--; + } + } +} diff --git a/Validate_Binary_Search_Tree.cpp b/Validate_Binary_Search_Tree.cpp new file mode 100644 index 0000000..d2d46cb --- /dev/null +++ b/Validate_Binary_Search_Tree.cpp @@ -0,0 +1,82 @@ +/*98. Validate Binary Search Tree QuestionEditorial Solution My Submissions +Total Accepted: 107794 +Total Submissions: 500597 +Difficulty: Medium +Given a binary tree, determine if it is a valid binary search tree (BST). + +Assume a BST is defined as follows: + +The left subtree of a node contains only nodes with keys less than the node's key. +The right subtree of a node contains only nodes with keys greater than the node's key. +Both the left and right subtrees must also be binary search trees. +Example 1: + 2 + / \ + 1 3 +Binary tree [2,1,3], return true. +Example 2: + 1 + / \ + 2 3 +Binary tree [1,2,3], return false.*/ + + + +/*Set the min_value and max_value +the left child should always less than the root.val +the right child should always larger than the root.val +update the min_value and max_value after each recursive +when check the left child, we set the max value as root.val +when check the right child, we set the min value as root.val*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +/** + * Definition for a binary tree node. + * struct TreeNode { + * int val; + * TreeNode *left; + * TreeNode *right; + * TreeNode(int x) : val(x), left(NULL), right(NULL) {} + * }; + */ +class Solution { +public: + bool isValidBST(TreeNode* root) { + return isValid(root, LONG_MIN, LONG_MAX); + } + + bool isValid(TreeNode* root, long min, long max){ // should be "long" + if(!root) return true; + if(root->val>=max || root->val<=min) return false; + // cout << root->val; + return isValid(root->left, min, root->val) && isValid(root->right, root->val, max); + } +}; + + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +/** + * Definition for a binary tree node. + * public class TreeNode { + * int val; + * TreeNode left; + * TreeNode right; + * TreeNode(int x) { val = x; } + * } + */ +public class Solution { + public boolean isValidBST(TreeNode root) { + return isValid(root, Long.MIN_VALUE, Long.MAX_VALUE); + } + + public boolean isValid(TreeNode root, long min, long max){ + if(root==null) return true; + if(root.val>=max || root.val<=min) return false; + return isValid(root.left, min, root.val) && isValid(root.right, root.val, max); + } +} \ No newline at end of file diff --git a/Walls_and_Gates.cpp b/Walls_and_Gates.cpp new file mode 100644 index 0000000..2439a1a --- /dev/null +++ b/Walls_and_Gates.cpp @@ -0,0 +1,106 @@ +/*286. Walls and Gates QuestionEditorial Solution My Submissions +Total Accepted: 16681 Total Submissions: 41393 Difficulty: Medium +You are given a m x n 2D grid initialized with these three possible values. + +-1 - A wall or an obstacle. +0 - A gate. +INF - Infinity means an empty room. We use the value 231 - 1 = 2147483647 to represent INF as you may assume that the distance to a gate is less than 2147483647. +Fill each empty room with the distance to its nearest gate. If it is impossible to reach a gate, it should be filled with INF. + +For example, given the 2D grid: +INF -1 0 INF +INF INF INF -1 +INF -1 INF -1 + 0 -1 INF INF +After running your function, the 2D grid should be: + 3 -1 0 1 + 2 2 1 -1 + 1 -1 2 -1 + 0 -1 3 4 +Hide Company Tags Google Facebook +Hide Tags Breadth-first Search +Hide Similar Problems (M) Surrounded Regions (M) Number of Islands (H) Shortest Distance from All Buildings +*/ + + + +/* BFS O(mn) time +push all gates into queue first, +for each gate, update its neighbor cells, and push them to queue +*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +class Solution { +public: + void wallsAndGates(vector>& rooms) { + if(rooms.size()==0 || rooms[0].size()==0) return; + queue> myqueue; + int row = rooms.size(); + int col = rooms[0].size(); + //find all 0 gates + for(int i = 0; i < row; ++i){ + for(int j = 0; j < col; ++j){ + if(rooms[i][j] == 0){ + myqueue.emplace(i,j); + } + } + } + + //set four directions + vector> dirs = {{-1,0},{1,0},{0,1},{0,-1}}; + while(!myqueue.empty()){ + int first = myqueue.front().first; + int second = myqueue.front().second; + myqueue.pop(); + for(auto d:dirs){ + int x = first+d.first; + int y = second + d.second; + // if x y out of range or it is obstasle, or has small distance aready + if(x<0 || x>=row || y<0 || y>=col + || rooms[x][y]<=rooms[first][second]) continue; + + rooms[x][y] = rooms[first][second] + 1; + myqueue.emplace(x,y); + } + } + } +}; + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class Solution { + public void wallsAndGates(int[][] rooms) { + if(rooms.length==0 || rooms[0].length==0) return; + Queue myqueue = new LinkedList<>(); + int row = rooms.length; + int col = rooms[0].length; + //find all 0 gates + for(int i = 0; i < row; ++i){ + for(int j = 0; j < col; ++j){ + if(rooms[i][j] == 0){ + myqueue.add(new int[]{i,j}); + } + } + } + + //set four directions + int[][] dirs = new int[][]{{-1,0},{1,0},{0,1},{0,-1}}; + while(!myqueue.isEmpty()){ + int[] q = myqueue.remove(); + for(int[] d:dirs){ + int x = q[0] + d[0]; + int y = q[1] + d[1]; + // if x y out of range or it is obstasle, or has small distance aready + if(x<0 || x>= row || y<0 || y>= col + || rooms[x][y]<=rooms[q[0]][q[1]]) continue; + + rooms[x][y] = rooms[q[0]][q[1]] + 1; + myqueue.add(new int[]{x,y}); + } + } + } +} diff --git a/Welcome_to_java.cpp b/Welcome_to_java.cpp new file mode 100644 index 0000000..5e1d569 --- /dev/null +++ b/Welcome_to_java.cpp @@ -0,0 +1,10 @@ +public class Solution { + + public static void main(String []argv) + { + //Write your solution here. + System.out.println("Hello World."); + System.out.println("Hello Java."); + } + +} \ No newline at end of file diff --git a/Wiggle_Sort.cpp b/Wiggle_Sort.cpp new file mode 100644 index 0000000..749daa1 --- /dev/null +++ b/Wiggle_Sort.cpp @@ -0,0 +1,73 @@ +/*280. Wiggle Sort QuestionEditorial Solution My Submissions +Total Accepted: 16869 Total Submissions: 31864 Difficulty: Medium +Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3].... + +For example, given nums = [3, 5, 2, 1, 6, 4], one possible answer is [1, 6, 2, 5, 3, 4]. + +Hide Company Tags Google +Hide Tags Array Sort +Hide Similar Problems (M) Sort Colors (M) Wiggle Sort II +*/ + + + +/*O(n) time +we do it in-place +the nums should satisfy 2 conditions +1. i is odd, nums[i] >= nums[i-1] +2. i is even, nums[i] <= nums[i-1] +just to fix the ordering of nums that not satisfy these 2 conditions +*/ +///////////////////////////////////////////////////////////////////////////////////// +//C++ +class Solution { +public: + void wiggleSort(vector& nums) { + if(nums.size() < 1) return; + for(int i = 1; i < nums.size(); ++i){ + //i&1==1 i is odd + //i&1==0 i is even + if(((i&1) && nums[i] < nums[i-1]) + || (!(i&1) && nums[i] > nums[i-1])){ + swap(nums[i], nums[i-1]); + } + //if can replace by if(i%2 == (nums[i-1]>nums[i])) + } + //another for: + /*for(int i = 1; i < nums.size(); ++i){ + swap(nums[i], nums[i-(i%2 ^ (nums[i-1] nums[i-1]){ + swap(nums, i); + } + } else if (i%2 == 1){ + //i is odd + if(nums[i] < nums[i-1]){ + swap(nums, i); + } + } + } + } + + //swap i with i-1 + //pass array into function + public void swap(int[] nums, int i){ + int temp = nums[i]; + nums[i] = nums[i-1]; + nums[i-1] = temp; + } +} diff --git a/Wiggle_Sort_2.cpp b/Wiggle_Sort_2.cpp new file mode 100644 index 0000000..b54567c --- /dev/null +++ b/Wiggle_Sort_2.cpp @@ -0,0 +1,72 @@ +/*324. Wiggle Sort II QuestionEditorial Solution My Submissions +Total Accepted: 16345 +Total Submissions: 67725 +Difficulty: Medium +Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3].... + +Example: +(1) Given nums = [1, 5, 1, 1, 6, 4], one possible answer is [1, 4, 1, 5, 1, 6]. +(2) Given nums = [1, 3, 2, 2, 3, 1], one possible answer is [2, 3, 1, 3, 1, 2]. + +Note: +You may assume all input has valid answer. + +Follow Up: +Can you do it in O(n) time and/or in-place with O(1) extra space? + +Credits: +Special thanks to @dietpepsi for adding this problem and creating all test cases. + +Hide Company Tags Google +Hide Tags Sort +Hide Similar Problems (M) Sort Colors (M) Kth Largest Element in an Array (M) Wiggle Sort +*/ + + + +/* O(n) time and/or in-place with O(1) extra space +the number on the even indexes are larger than the odd indexes +1. sort the array, from small to high +2. the first half of array insert into the odd index +the last haf of array insert into the even index +use & AND operator to see this position is odd index or even index +from the back of string to change +eg: +Small half: 4 . 3 . 2 . 1 . 0 . +Large half: . 9 . 8 . 7 . 6 . 5 +---------------------------------- +Together: 4 9 3 8 2 7 1 6 0 5*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +class Solution { +public: + void wiggleSort(vector& nums) { + vector temp(nums); + sort(temp.begin(), temp.end()); + for(int i = nums.size()-1, j = 0, k = i/2+1; i>=0; i--){ + nums[i] = temp[i&1 ? k++: j++]; + } + } +}; + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class Solution { + public void wiggleSort(int[] nums) { + int[] temp = new int[nums.length]; + for(int i = 0 ; i < nums.length; ++i){ + temp[i] = nums[i]; + } + //int[] temp = nums.clone(); //copy nums to temp --- way 1 + //int[] temp = Arrays.copyOf(nums, nums.length); //copy nums to temp --- way 2 + Arrays.sort(temp); + + for(int i = nums.length-1, j = 0, k = i/2+1; i>=0; --i){ + nums[i] = temp[(i&1)!=0 ? k++: j++]; + } + } +} diff --git a/Wiggle_Subsequence.cpp b/Wiggle_Subsequence.cpp new file mode 100644 index 0000000..28460cf --- /dev/null +++ b/Wiggle_Subsequence.cpp @@ -0,0 +1,111 @@ +/*376. Wiggle Subsequence QuestionEditorial Solution My Submissions +Total Accepted: 10129 Total Submissions: 29550 Difficulty: Medium +A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positive or negative. A sequence with fewer than two elements is trivially a wiggle sequence. + +For example, [1,7,4,9,2,5] is a wiggle sequence because the differences (6,-3,5,-7,3) are alternately positive and negative. In contrast, [1,4,7,2,5] and [1,7,4,5,5] are not wiggle sequences, the first because its first two differences are positive and the second because its last difference is zero. + +Given a sequence of integers, return the length of the longest subsequence that is a wiggle sequence. A subsequence is obtained by deleting some number of elements (eventually, also zero) from the original sequence, leaving the remaining elements in their original order. + +Examples: +Input: [1,7,4,9,2,5] +Output: 6 +The entire sequence is a wiggle sequence. + +Input: [1,17,5,10,13,15,10,5,16,8] +Output: 7 +There are several subsequences that achieve this length. One is [1,17,10,13,10,16,8]. + +Input: [1,2,3,4,5,6,7,8,9] +Output: 2 +Follow up: +Can you do it in O(n) time? + +Credits: +Special thanks to @agave and @StefanPochmann for adding this problem and creating all test cases. + +Subscribe to see which companies asked this question*/ + + + +/* +mark a variable larger to check if the next element should larger than current element +1,7,8,4,5,2 +1, larger mark: true, 7 list:1,7 +7, larger mark: false, 8 list: 1,8 change the list +8, larger mark: false, 4 list:1,8,4 +to each element, check if this element is satisfy larger mark, if it is, push into the list +else, update the last element in the list +we can directly update the original nums array*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +class Solution { +public: + int wiggleMaxLength(vector& nums) { + if(nums.size()==0 || nums.size()==1) return nums.size(); + + int k = 1; + while(knums[k-1]; + for(int i = k+1; i < nums.size(); ++i){ + if(larger && nums[i]nums[i-1]){ + nums[ret] = nums[i]; + ret++; + larger = !larger; + } else { + nums[ret-1] = nums[i]; + } + } + + return ret; + } +}; + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class Solution { + public int wiggleMaxLength(int[] nums) { + if(nums.length==0 || nums.length==1) return nums.length; + + int k = 1;//check if the first element is equal to the next one + while(knums[k-1]; + for(int i = k+1; i < nums.length; ++i){ + if(larger && nums[i]nums[i-1]){ + nums[ret] = nums[i]; + ret++; + larger = !larger; + } else { + nums[ret-1] = nums[i]; + } + } + + // for(int i = 0; i < ret; ++i){ + // System.out.print(nums[i] + " "); + // } + + return ret; + } +} diff --git a/Wildcard_Matching.cpp b/Wildcard_Matching.cpp new file mode 100644 index 0000000..af068a0 --- /dev/null +++ b/Wildcard_Matching.cpp @@ -0,0 +1,163 @@ +/*44. Wildcard Matching QuestionEditorial Solution My Submissions +Total Accepted: 71003 Total Submissions: 383621 Difficulty: Hard +Implement wildcard pattern matching with support for '?' and '*'. + +'?' Matches any single character. +'*' Matches any sequence of characters (including the empty sequence). + +The matching should cover the entire input string (not partial). + +The function prototype should be: +bool isMatch(const char *s, const char *p) + +Some examples: +isMatch("aa","a") → false +isMatch("aa","aa") → true +isMatch("aaa","aa") → false +isMatch("aa", "*") → true +isMatch("aa", "a*") → true +isMatch("ab", "?*") → true +isMatch("aab", "c*a*b") → false +Hide Company Tags Google Snapchat Facebook +Hide Tags Dynamic Programming Backtracking Greedy String +Hide Similar Problems (H) Regular Expression Matching +*/ + + + +/*linear time constant space +use two index, i1 for str, i2 for pattern +index for * +match for * at s postion +start checking string + if p[i2]=='?' or s[i1]==p[i2], increase i1, i2 + else if p[i2]=='*', mark this position as index, match=i1 + else if index!=-1, means exist *, i2=index+1, match++, i1=match + else return false, character does not match +start checking remaing char in pattern + while (p < pattern.length() && pattern.charAt(p) == '*') p++; +return p == pattern.length(); + */ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +class Solution { +public: + bool isMatch(string s, string p) { + int i1 = 0; //point to s + int i2 = 0; //point to p + int match = 0; + int index = -1; + while(i1 < s.size()){ + if(i2& wordDict) { + vector ret(s.size()+1,false); + ret[0]=true; + for(int i = 1; i <= s.size(); ++i){//start from 1 to the end of string + for(int j = 0; j < i; ++j){ + if(ret[j] && wordDict.find(s.substr(j,i-j))!=wordDict.end()){ + // cout << i << " " << j << endl; + ret[i] = true; + break; + } + } + } + return ret[s.size()]; + } +}; + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class Solution { + public boolean wordBreak(String s, Set wordDict) { + boolean[] ret = new boolean[s.length()+1]; //initialize s.length + ret[0] = true; + for(int i = 1; i <= s.length(); ++i){//start from 1 to the end of string + for(int j = 0; j < i; ++j){ + if(ret[j] && wordDict.contains(s.substring(j,i))){ + ret[i] = true; + break; + } + } + } + return ret[s.length()]; + } +} diff --git a/Word_Break_2.cpp b/Word_Break_2.cpp new file mode 100644 index 0000000..b8f7ff9 --- /dev/null +++ b/Word_Break_2.cpp @@ -0,0 +1,92 @@ +/*140. Word Break II QuestionEditorial Solution My Submissions +Total Accepted: 68499 Total Submissions: 321317 Difficulty: Hard +Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word. + +Return all such possible sentences. + +For example, given +s = "catsanddog", +dict = ["cat", "cats", "and", "sand", "dog"]. + +A solution is ["cats and dog", "cat sand dog"]. + +Hide Company Tags Dropbox Google Uber Snapchat Twitter +Hide Tags Dynamic Programming Backtracking +*/ + + + +/* O(len(wordDict) ^ len(s / minWordLenInDict)), because there're len(wordDict) possibilities for each cut +use a hashmap to store the previous results, to avoid duplicates +for each word in wordDict, find its own list, and add it to ret +*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +class Solution { + private: + unordered_map> mymap; + +public: + vector wordBreak(string s, unordered_set& wordDict) { + if(mymap.count(s)) return mymap[s]; + + vector ret; + if(wordDict.count(s)){ + ret.push_back(s); + } + + for(int i = 1; i < s.size(); ++i){ + //backtracking + string word = s.substr(i); + if(wordDict.count(word)){ + string rem = s.substr(0, i); + vector pre = combine(word, wordBreak(rem, wordDict)); + ret.insert(ret.end(), pre.begin(), pre.end()); + } + } + + mymap[s] = ret; + return ret; + } + + vector combine(string word, vector pre){ + for(int i = 0; i < pre.size(); ++i){ + pre[i] += " " + word; + } + return pre; + } +}; + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class Solution { + HashMap> mymap = new HashMap<>(); + //store previous results, remember init it + + public List wordBreak(String s, Set wordDict) { + if(mymap.containsKey(s)) + return mymap.get(s); + + List ret = new LinkedList<>(); + if(s.length()==0){ + ret.add(""); + return ret; + } + + for(String w:wordDict){ + if(s.startsWith(w)){ // s is a string start with w + List sublist = wordBreak(s.substring(w.length()), wordDict); + for(String sub:sublist){ + ret.add(w + (sub.isEmpty()?"":" ") + sub); + } + } + } + + mymap.put(s, ret); + return ret; + } +} diff --git a/Word_Ladder_2.cpp b/Word_Ladder_2.cpp new file mode 100644 index 0000000..914191e --- /dev/null +++ b/Word_Ladder_2.cpp @@ -0,0 +1,291 @@ +/*126. Word Ladder II QuestionEditorial Solution My Submissions +Total Accepted: 49838 +Total Submissions: 362598 +Difficulty: Hard +Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, such that: + +Only one letter can be changed at a time +Each intermediate word must exist in the word list +For example, + +Given: +beginWord = "hit" +endWord = "cog" +wordList = ["hot","dot","dog","lot","log"] +Return + [ + ["hit","hot","dot","dog","cog"], + ["hit","hot","lot","log","cog"] + ] +Note: +All words have the same length. +All words contain only lowercase alphabetic characters. +Subscribe to see which companies asked this question*/ + + + +/*Treat each word as a node of a tree. There are two trees. One tree's root node is "beginWord", and the other tree's root node is "endWord". + +The root node can yield all his children node, and they are the second layer of the tree. The second layer can yield all their children, then we get the third layer of the tree, ... , and so on. + +When one tree yield a new child, we search it in the last layer of the other tree. If we find an identical node in that tree, then we get some ladders connect two roots("beginWord" -> ... -> "endWord"). + +Another thing should be considered is: two(or more) different nodes may yield an identical child. That means the child may have two(or more) parents. For example, "hit" and "hot" can both yield "hat", means "hat" has two parents. + +So, the data struct of tree-node is: + +class Node { +public: + string word; + vectror parents; + Node(string w) : word(w) {} +} +Note: we don't need a children field for Node class, because we won't use it. + +Two nodes are considered equal when their word field are equal. So we introduce an compare function: + +bool nodecmp(Node* pa, Node* pb) +{ + return pa->word < pb->word; +} +Then we use nodecmp as the compare function to build a node set. + +typedef bool (*NodeCmper) (Node*, Node*); +typedef set NodeSet; +NodeSet layer(nodecmp); +Then we can store/search pointers of nodes in node set layer. For example: + +Node node1("hit"), node2("hot"), node3("hat"); +layer.insert(&node1); +layer.insert(&node2); +layer.insert(&node3); +auto itr = layer.find(new Node("hot")); +cout << (*itr)->word; // output: hot +Using these data structures, we can solve this problem with bi-direction BFS algorithm. Below is the AC code, and it is very very fast.*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ + class Node; + + typedef vector Ladder; + typedef unordered_set StringSet; + typedef bool (*NodeCmper) (Node*, Node*); + typedef set NodeSet; + + class Node{ + public: + string word; + vector parents; + Node(string w): word(w) {} + + void addparent(Node* parent){ + parents.push_back(parent); + } + + void yieldChildren(NodeSet& nextlayer, StringSet& wordlist, NodeSet& targetlayer, + vector& ladders, bool forward){ + //if the child is found in $targetlayer, which means we found ladders that connect + // BEGIN-WORD and END-WORD, then we get all paths through this node to its ROOT node + // and all paths through the target child node to its ROOT node, and combine the two + // group of paths to a group of ladders, and append these ladders to $ladders + //else if the $ladders is empty, + // if the child is found in $nextlayer, then get that child, and add this node to its parents + // else, add the child to nextlayer, and add this node to its parents + //else, do nothing + string nextword = word; + for(int i = 0, n = nextword.length(); i < n; i++){ + char oldchar = nextword[i]; + for(nextword[i] = 'a'; nextword[i] <= 'z'; nextword[i]++){ + if(wordlist.count(nextword)){ //found a valid child-word, yield this child + //unordered_set---count---count elements with a specific key + Node *child = new Node(nextword); + yield(child, nextlayer, targetlayer, ladders, forward); + } + } + nextword[i] = oldchar; + } + } + + //yield one child + void yield(Node* child, NodeSet& nextlayer, NodeSet& targetlayer, + vector& ladders, bool forward){ + auto it = targetlayer.find(child); + if(it != targetlayer.end()){ + for(Ladder p1: this->getpaths()){ + for(Ladder p2: (*it)->getpaths()){ + if(forward){ + ladders.push_back(p1); + ladders.back().insert(ladders.back().end(), p2.rbegin(), p2.rend()); + } else { + ladders.push_back(p2); + ladders.back().insert(ladders.back().end(), p1.rbegin(), p1.rend()); + } + } + } + } else if(ladders.empty()){ + auto it = nextlayer.find(child); + if(it != nextlayer.end()){ + (*it)->addparent(this); + } else { + child->addparent(this); + nextlayer.insert(child); + } + } + } + + vector getpaths(){ + vector ladders; + if(parents.empty()){ + ladders.push_back(Ladder(1,word)); + } else { + for(Node *p: parents){ + for(Ladder lad : p->getpaths()){ + ladders.push_back(lad); + ladders.back().push_back(word); + } + } + } + return ladders; + } + }; + + bool nodecmp(Node* na, Node* nb){ + return na->word < nb->word; + } + +class Solution { +public: + vector> findLadders(string beginWord, string endWord, unordered_set &wordList) { + vector ladders; + Node headroot(beginWord), tailroot(endWord); + NodeSet frontlayer(nodecmp), backlayer(nodecmp); + NodeSet *p_layerA = &frontlayer, *p_layerB = &backlayer; + bool forward = true; + + if(beginWord == endWord){ + ladders.push_back(Ladder(1,beginWord)); + return ladders; + } + + frontlayer.insert(&headroot); + backlayer.insert(&tailroot); + wordList.insert(endWord); + while(!p_layerA->empty() && !p_layerB->empty() && ladders.empty()){ + NodeSet nextlayer(nodecmp); + if(p_layerA->size() > p_layerB->size()){ + swap(p_layerA, p_layerB); + forward = !forward; + } + + for(Node* node : *p_layerA){ + wordList.erase(node->word); + } + + for(Node *node : *p_layerA){ + node->yieldChildren(nextlayer, wordList, *p_layerB, ladders, forward); + } + + swap(*p_layerA, nextlayer); + } + + return ladders; + } +}; + + + + + + +/*The solution contains two steps 1 Use BFS to construct a graph. 2. Use DFS to construct the paths from end to start.Both solutions got AC within 1s. + +The first step BFS is quite important. I summarized three tricks + +Using a MAP to store the min ladder of each word, or use a SET to store the words visited in current ladder, when the current ladder was completed, delete the visited words from unvisited. That's why I have two similar solutions. +Use Character iteration to find all possible paths. Do not compare one word to all the other words and check if they only differ by one character. +One word is allowed to be inserted into the queue only ONCE.*/ + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class Solution { + private Map > mymap; + private List > ret; + + public List> findLadders(String beginWord, String endWord, Set wordList) { + ret = new ArrayList>(); + if(wordList.size() == 0){ + return ret; + } + + int min = Integer.MAX_VALUE; + + Queue q = new ArrayDeque(); + q.add(beginWord); + + mymap = new HashMap>(); + + Map ladder = new HashMap(); + for(String w:wordList){ + ladder.put(w, Integer.MAX_VALUE); + } + ladder.put(beginWord, 0); + + wordList.add(endWord); + while(!q.isEmpty()){//BFS:Dijisktra search + String word = q.poll(); + int step = ladder.get(word) + 1;//step indicates how many steps are needed to travel to one word + if(step>min) break; + + for(int i = 0; i < word.length(); i++){ + StringBuilder sb = new StringBuilder(word); + for(char ch = 'a'; ch <= 'z'; ch++){ + sb.setCharAt(i, ch); + String newWord = sb.toString(); + if(ladder.containsKey(newWord)){ + if(step>ladder.get(newWord)){ + continue; + } else if(step newList = new LinkedList(); + newList.add(word); + mymap.put(newWord, newList); + //mymap.put(newWord, new LinkedList(Arrays.asList(new String[]{word}))); + } + + if(newWord.equals(endWord)){ + min = step; + } + }// end if wordList contains newWord + }//end if iteration from 'a' to 'z' + }//end if iteration from the first to the last + } + + LinkedList res = new LinkedList(); + backTrace(endWord, beginWord, res); + + return ret; + } + + private void backTrace(String word, String start, List list){ + if(word.equals(start)){ + list.add(0,start); + ret.add(new ArrayList(list)); + list.remove(0); + return; + } + list.add(0, word); + if(mymap.get(word) != null){ + for(String s:mymap.get(word)){ + backTrace(s, start, list); + } + } + list.remove(0); + } +} \ No newline at end of file diff --git a/Word_Pattern.cpp b/Word_Pattern.cpp new file mode 100644 index 0000000..60dcc8c --- /dev/null +++ b/Word_Pattern.cpp @@ -0,0 +1,80 @@ +bool wordPattern(string pattern, string str) { + int *a = new int[26](); + unordered_map m; + + int patternIdx = 0, startIndex = 0; + + if (str.length() && str[str.length() - 1] != ' ') { + str += ' '; + } //find if the end of the string str is ' ' + + for (int i = 0; i < str.length(); ++i) { + if (patternIdx == pattern.length()) { + return false; + } + + if (str[i] == ' ') { + string sub = str.substr(startIndex, i - startIndex); + startIndex = ++i; //need to change the position + + int aIdx = pattern[patternIdx] - 97; + if (m.find(sub) == m.end()) { //find if there has been a bijection between pattern and str + if (!a[aIdx]) { + m[sub] = pattern[patternIdx]; + a[aIdx] = 1; + } else { + return false; + } + } else if (m[sub] != pattern[patternIdx]){ + return false; + } + patternIdx++; + } + } + return patternIdx == pattern.length(); +} + + + + +class Solution { +public: + bool wordPattern(string pattern, string str) { + vector apattern(26,0); + unordered_map sMap; + int spos = 0; + int aIdx1 = 0; + + if(str.length() && str[str.length()-1] != ' ') + str += ' '; + + for(int i = 0; i < str.length(); ++i) + { + if(aIdx1 == pattern.length()) + return false; + + if(str[i] == ' ') + { + string nstr = str.substr(spos, i - spos); + spos = ++i; + + int aIdx = pattern[aIdx1] - 97; + if(sMap.find(nstr) == sMap.end()) + { + if(!apattern[aIdx]) + { + sMap[nstr] = pattern[aIdx1]; + apattern[aIdx] = 1; + } + else + return false; + } + else if(sMap[nstr] != pattern[aIdx1]) + return false; + + aIdx1++; + } + } + return (aIdx1 == pattern.length()); + } +}; \ No newline at end of file diff --git a/Word_Search_2.cpp b/Word_Search_2.cpp new file mode 100644 index 0000000..3af338a --- /dev/null +++ b/Word_Search_2.cpp @@ -0,0 +1,186 @@ +/* +212. Word Search II QuestionEditorial Solution My Submissions +Total Accepted: 24287 +Total Submissions: 118222 +Difficulty: Hard +Given a 2D board and a list of words from the dictionary, find all words in the board. + +Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once in a word. + +For example, +Given words = ["oath","pea","eat","rain"] and board = + +[ + ['o','a','a','n'], + ['e','t','a','e'], + ['i','h','k','r'], + ['i','f','l','v'] +] +Return ["eat","oath"]. +Note: +You may assume that all inputs are consist of lowercase letters a-z. + +click to show hint. + +You would need to optimize your backtracking to pass the larger test. Could you stop backtracking earlier? + +If the current candidate does not exist in all words' prefix, you could stop backtracking immediately. What kind of data structure could answer such query efficiently? Does a hash table work? Why or why not? How about a Trie? If you would like to learn how to implement a basic trie, please work on this problem: Implement Trie (Prefix Tree) first. + +Hide Company Tags Microsoft Google Airbnb +Hide Tags Backtracking Trie +Hide Similar Problems (M) Word Search +*/ + + + + +/*use trie +dfs(board, i, j, TrieNode p, List ret) --- + i,j is the board position which we search start + ret is the list we need to return at the end +TrieNode --- next[], word(the end char of wordsTrie, store the words itself) +buildTrie(String[] string) --- + build the word trie according to given string array of words +findWords --- build the word trie \ + DFS searching the board +*/ + +//C++ +///////////////////////////////////////////////////////////////////////////////////////////////class Solution { + class TrieNode{ + public: + vector next; + string word; + TrieNode(){ + this->next = vector(26, nullptr); + this->word = ""; + } + }; + + public: + TrieNode* buildTrie(vector &words){ + TrieNode *root = new TrieNode(); + for(string w:words){ + TrieNode *p = root; + for(int i = 0; i < w.size(); i++){ + int c = w[i]-'a'; + if(p->next[c]==nullptr){ + p->next[c] = new TrieNode(); + } + p = p->next[c]; + } + p->word = w; + } + return root; + } + + public: + void dfs(vector > &board, int i, int j, TrieNode *p, vector &ret){ + char c = board[i][j]; + if(c=='#' || p->next[c-'a']==nullptr){ + return; + } + + p = p->next[c-'a']; + if(p->word != ""){ + ret.push_back(p->word); + p->word = ""; + } + + board[i][j] = '#'; + if(i > 0) + dfs(board, i-1, j, p, ret); + if(j > 0) + dfs(board, i, j-1, p, ret); + if(i < board.size()-1) + dfs(board, i+1, j, p, ret); + if(j < board[0].size()-1) + dfs(board, i, j+1, p, ret); + + board[i][j] = c; + } + +public: + vector findWords(vector>& board, vector& words) { + vector ret; + TrieNode *root = buildTrie(words); + + for(int i = 0; i < board.size(); i++){ + for(int j = 0; j < board[0].size(); j++){ + dfs(board, i, j, root, ret); + } + } + return ret; + } +}; + + + + + + + + +//java +//////////////////////////////////////////////////////////////////////////////////////////////// +public class Solution { + class TrieNode{ + TrieNode[] next = new TrieNode[26]; + String word; + } + + public TrieNode buildTrie(String[] words){ + TrieNode root = new TrieNode(); + for(String w:words){ + TrieNode p = root; + for(char c:w.toCharArray()){ + int i = c-'a'; + if(p.next[i] == null){ + p.next[i] = new TrieNode(); + } + p = p.next[i]; + } + p.word = w; + } + + return root; + } + + public void dfs(char[][] board, int i, int j, TrieNode p, List ret){ + char c = board[i][j]; + if(c=='#' || p.next[c-'a']==null) // this cell has already been searched + return; + + p = p.next[c-'a']; + if(p.word!=null){ + //once find a word, add it into list, and change it to null to avoid count it again + ret.add(p.word); + p.word = null; + } + + board[i][j] = '#'; //mark this cell has already been searched + if(i > 0) + dfs(board, i-1, j, p, ret); + if(j > 0) + dfs(board, i, j-1, p, ret); + if(i < board.length - 1) + dfs(board, i+1, j, p, ret); + if(j < board[0].length - 1) + dfs(board, i, j+1, p, ret); + + board[i][j] = c; //recover this node + } + + public List findWords(char[][] board, String[] words) { + List ret = new ArrayList<>(); + if(board.length==0 || board[0].length==0) return ret; + TrieNode root = buildTrie(words); + + for(int i = 0; i < board.length; i++){ + for(int j = 0; j < board[0].length; j++){ + dfs(board, i, j, root, ret); + } + } + return ret; + } +} \ No newline at end of file diff --git a/ZigZag_Iterator.cpp b/ZigZag_Iterator.cpp new file mode 100644 index 0000000..bdb278f --- /dev/null +++ b/ZigZag_Iterator.cpp @@ -0,0 +1,105 @@ +/*281. Zigzag Iterator QuestionEditorial Solution My Submissions +Total Accepted: 15095 Total Submissions: 32722 Difficulty: Medium +Given two 1d vectors, implement an iterator to return their elements alternately. + +For example, given two 1d vectors: + +v1 = [1, 2] +v2 = [3, 4, 5, 6] +By calling next repeatedly until hasNext returns false, the order of elements returned by next should be: [1, 3, 2, 4, 5, 6]. + +Follow up: What if you are given k 1d vectors? How well can your code be extended to such cases? + +Clarification for the follow up question - Update (2015-09-18): +The "Zigzag" order is not clearly defined and is ambiguous for k > 2 cases. If "Zigzag" does not look right to you, replace "Zigzag" with "Cyclic". For example, given the following input: + +[1,2,3] +[4,5,6,7] +[8,9] +It should return [1,4,8,2,5,9,3,6,7]. +Hide Company Tags Google +Hide Tags Design +Hide Similar Problems (M) Binary Search Tree Iterator (M) Flatten 2D Vector (M) Peeking Iterator (M) Flatten Nested List Iterator +*/ + + + +/*c++ --- use queue to store the iterator of v1 and v2 or k vector's iterator +java --- use linkedlist to store the iterator of v1 and v2 or k vector's iterator +next() --- remove the first iterator, after poll it, if ther is element in it, add it into the back of list +hasNext() --- check if the list of iterator is empty +*/ + +///////////////////////////////////////////////////////////////////////////////////// +//C++ +class ZigzagIterator { + private: + queue::iterator, vector::iterator>> mylist; + +public: + ZigzagIterator(vector& v1, vector& v2) { + if(v1.size()!=0){ + mylist.push(make_pair(v1.begin(), v1.end()));//make pair + } + if(v2.size()!=0){ + mylist.push(make_pair(v2.begin(), v2.end())); + } + } + + int next() { + vector::iterator it = mylist.front().first; + vector::iterator itend = mylist.front().second; + mylist.pop(); + if(it+1!=itend){ + mylist.push(make_pair(it+1,itend)); + } + return *it; + } + + bool hasNext() { + return !mylist.empty(); + } +}; + +/** + * Your ZigzagIterator object will be instantiated and called as such: + * ZigzagIterator i(v1, v2); + * while (i.hasNext()) cout << i.next(); + */ + + + + +///////////////////////////////////////////////////////////////////////////////////// +//Java +public class ZigzagIterator { + private LinkedList mylist = new LinkedList<>(); //initialize LinkedList, otherwise cannot use poll() function + + public ZigzagIterator(List v1, List v2) { + if(!v1.isEmpty()){ + mylist.add(v1.iterator()); + } + if(!v2.isEmpty()){ + mylist.add(v2.iterator()); + } + } + + public int next() { + Iterator it = mylist.poll(); + int ret = (Integer)it.next(); //first transfer it into int + if(it.hasNext()){ + mylist.add(it); + } + return ret; + } + + public boolean hasNext() { + return !mylist.isEmpty(); + } +} + +/** + * Your ZigzagIterator object will be instantiated and called as such: + * ZigzagIterator i = new ZigzagIterator(v1, v2); + * while (i.hasNext()) v[f()] = i.next(); + */ diff --git a/Zigzag_Conversion.cpp b/Zigzag_Conversion.cpp new file mode 100644 index 0000000..53e0367 --- /dev/null +++ b/Zigzag_Conversion.cpp @@ -0,0 +1,58 @@ +/* +The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) + +P A H N +A P L S I I G +Y I R +And then read line by line: "PAHNAPLSIIGYIR" +Write the code that will take a string and make this conversion given a number of rows: + +string convert(string text, int nRows); +convert("PAYPALISHIRING", 3) should return "PAHNAPLSIIGYIR". +*/ + +class Solution { +public: + string convert(string s, int numRows) { + if(numRows<=1) return s; //if there is only one line, it is no need to change the string + + int sCircle = 2 * numRows - 2; //count the number of elements in one circle + string sRes = ""; + for(int i = 0; i < numRows; ++i){ //let i control the rows + for(int j = i; j < s.size(); j += sCircle){ + sRes += s[j]; + int secondS = (j-i) + sCircle-i; + if(i!=0 && i!=numRows-1 && secondS bear != 'koala'); +// let bears = ['polar','koala'].filter((bear) => { +// return bear != 'koala'; +// }); +// console.log(bears); //['polar'] + +// class Bear{ +// constructor(){ +// this.type = 'bear'; +// } +// says(say){ +// setTimeout(()=>{ +// console.log(this.type + 'says' + say); +// }.bind(this),1000) +// } +// } +// var bear = new Bear(); +// bear.says(); //bear says undefined + +// var bears = [ +// 'grizzly', +// 'polar', +// ].join('\n') // grizzly +// console.log(bears) // polar + +// let bears = ' +// grizzly +// polar +// ' +// console.log(bears) + +// let bears = 'grizzly'; +// let says = 'growl'; +// console.log('The ${bear} says ${says'); //The grizzly says growl + +// let bear = 'grizzly'; +// let says = 'growl'; +// let zoo = {bear, says} +// console.log(zoo); //Object {bear:"grizzly", says:"growl"} + +// let grizzly = {type:'grizzly', many:2}; +// let{type, many} = grizzly; +// console.log(many,type); //2"gizzly" + +// function bear(type){ +// type = type || 'grizzly'; +// console.log(type); //girzzly +// } +// bear() + +// function bear(type = 'grizzly'){ +// console.log(type); //girzzly +// } +// bear() + +// function bear(...type){ +// console.log(type); +// } +// bear('polar','grizzly'); //{"polar","grizzly"} + +/* +JavaScript ES6 Template Strings + +Here's a useful video related to the major features in ES6 including template strings: + + +Template strings introduce a way to define strings with domain-specific languages (DSLs). It provides improved string interpolation, embedded expressions, multiline strings, formatting, and tagging for safe HTML. + +Template Strings + +Template strings are string literals allowing embedded expressions. +We can use multi-line strings and string interpolation features with them. + +Multiline Strings + +Any new line characters inserted in the source are part of the template string. +SAMPLE CODE + +console.log(`The HackerRank team is on a mission to flatten the world by restructuring +the DNA of every company on the planet. We rank programmers based on +their coding skills, helping companies source great programmers and reduce +the time to hire.`); +OUTPUT + +The HackerRank team is on a mission to flatten the world by restructuring +the DNA of every company on the planet. We rank programmers based on +their coding skills, helping companies source great programmers and reduce +the time to hire. +String Interpolation + +We can embed expressions within template strings by making use of its syntactic sugar. +SAMPLE CODE + +var contestant = "DOSHI"; +var score = "20"; + +console.log(`Congratulations ${contestant}!, Your score is ${score}.`); +OUTPUT + +Congratulations DOSHI!, Your score is 20. +Task + +Your task is to create a template string and assign it to the variable my_template_string. + +The template string should contain the following data only: + +My name is ${my_name}. +My id is ${my_id}. +My address is ${my_address}. +Note + +Do not create any variable other than my_template_string. +Do not print anything on the console. +Replace the blank (_______________________) with the template string. +*/ +/* +TO ANYONE STRUGGLING: +YOU HAVE TO USE ` INSTEAD OF ' or ". +You can find that key under the 'Esc' button, to the left of 1, above the 'tab' button on your keyboard. +*/ + +var my_template_string = +`My name is ${my_name}. +My id is ${my_id}. +My address is ${my_address}.`; + + diff --git a/test.cpp b/test.cpp new file mode 100644 index 0000000..bc276e6 --- /dev/null +++ b/test.cpp @@ -0,0 +1,73 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +int main(){ + double pi = 3.1415926; + complex w1(0,pi/3); + complex w2=exp(w1); + + vector > w(6); + w[0] = 1; + w[1] = w2; + for(int i = 2; i < w.size(); i++){ + w[i] = pow(w2,i); + } + + complex a0(2,0); + complex a1(4,0); + complex a2(3,0); + + vector > y(6); + for(int i = 0; i < y.size(); i++){ + y[i] = a0 + a1*w[i] + a2*w[i]*w[i]; + cout << y[i]; + } + cout << endl; + + complex b0(3,0); + complex b1(5,0); + complex b2(3,0); + complex b3(2,0); + + vector > z(6); + for(int i = 0; i < z.size(); i++){ + z[i] = b0 + b1*w[i] + b2*w[i]*w[i] + b3*w[i]*w[i]*w[i]; + cout << z[i]; + } + cout << endl; + + vector > yz(6); + for(int i = 0; i < yz.size(); i++){ + yz[i] = y[i]*z[i]; + cout << yz[i]; + } + cout << endl; + + vector > c(6); + complex n(6,0); + for(int i = 0; i < c.size(); i++){ + complex yzsum(0,0); + for(int j = 0; j < yz.size(); j++){ + yzsum += yz[j]/pow(w[i],j); + } + c[i] = yzsum/n; + cout << c[i]; + } + cout << endl; + + + return 0; +} \ No newline at end of file diff --git a/test.exe b/test.exe new file mode 100644 index 0000000000000000000000000000000000000000..aff4f0ab76dccb9ba6d344d32a3ba63f6ae14a68 GIT binary patch literal 95649 zcmeFae|!|xxj#OeY+wTmvqI3QQC7QHqKJuNB^q^=ET9sMLIfodtq}DV6=4@p2_&6e z&2(H${n6T9Z9#3N_tKVoO92&e^MiyR{)m7Yegq<-&aj995kf%r`+lF9*=&&B`tAMi zzCMB7Gjq;!p7WgNdCqg5^PDrY#dp<8>5?Ql@kt~kX*E**`NjAD{8feG{)6A_FRjRY z?}F8iaqnF)@qq_tduPsieb!TZo7)20va z*RPMyLR}J&q;U?H^x&_DPm-D>X;CjpYL|Ma_jRP5E!6<19v`gU@1oNFA@! zOu8MoB>mzq4|llf`nf~&OOm`MEGw`M{;b5jksQ*pOzZMrNSt1Wlzp0dEe?k?nS}j= zzv02@^MWXAd&?Agr9>w~Y3l){wD zD(Rls@CVIyO&+4dgtwK*f)(_Qx_u&V1+P4SV?XLG04ou2!5N}mFY~}#0oP~&SP9{J z=KR0Af0Y9hl>OOSk}XAByxm0)Li5fs@d%H^~J5e`!PvU zIvsMj4tEg%{Sj$&CBCHmn9`U%rQRt;S6syVYo7;};Mvzg#bUv6*FJ|NwBs$vRf_kD z1}~EGccdVv&gwt6kuSkrBo_QLT4h0^Wpx67@!wy29+CVir5=gXZ#L@%$AO@52#~19 z0;`@e4OtbnRu}BdTM38Wks!Nw4kB8gFs|rXCK~yCo>_Jl%4$h}N@YQPBLE^h1f_EL z;K@WnE%LebGtZDDaM^9_Mvlp-=$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/dev/null +++ b/unordered_map.cpp @@ -0,0 +1,43 @@ +#include +#include +#include +#include +#include + +using namespace std; + +int main() +{ + unordered_map stringmap; + unordered_map string1({ { "apple","red" }, { "orange", "orange" }, + { "lemon" , "yellow" } }); + stringmap = string1; + cout << "contains: "; + for (auto& x : string1) cout << " " << x.first << ":" << x.second; + + cout << endl; + unordered_map stringmap1(string1.begin(), string1.end()); + cout << "contains2: "; + for (auto& x : stringmap1) cout << " " << x.first << ":" << x.second; + + std::unordered_map + myrecipe, + mypantry = { { "milk",2.0 },{ "flour",1.5 } }; + + std::pair myshopping("baking powder", 0.3); + + myrecipe.insert(myshopping); // copy insertion + myrecipe.insert(std::make_pair("eggs", 6.0)); // move insertion + myrecipe.insert(mypantry.begin(), mypantry.end()); // range insertion + myrecipe.insert({ { "sugar",0.8 },{ "salt",0.1 } }); // initializer list insertion + myrecipe["ti"] = 0.5; + + std::cout << "myrecipe contains:" << std::endl; + for (auto& x : myrecipe) + std::cout << x.first << ": " << x.second << std::endl; + + std::cout << std::endl; + + + return 0; +} \ No newline at end of file diff --git a/variables.java b/variables.java new file mode 100644 index 0000000..4a43801 --- /dev/null +++ b/variables.java @@ -0,0 +1,25 @@ +/* +Explanation + +Variables can be thought of as named containers where we can store data. +Data stored inside a variable can be retrieved by naming it at a later point. + +A variable in JavaScript is declared by using the var keyword: + +SAMPLE CODE + +var website = "hackerrank"; //Variable Declaration + +console.log(website); //Displaying variable website's content to console. +OUTPUT + +hackerrank +To learn more about valid JavaScript variable names, click here. + +Task + +In the editor below, declare a variable named newVariable and assign it the following string, "My First Variable". +*/ + +//Write your code below this line. +var newVariable = "My First Variable";