Have a question about this project? Example 1: Sliding Window Maximum, 花花酱 LeetCode 438. Contribute to AhJo53589/leetcode-cn development by creating an account on GitHub. Feiyang's Blogs. privacy statement. Big O Notation - … This lecture explains how to find and print all the permutations of a given string. In other words, one of the first string’s permutations is the substring of the second string. Group all anagrams from a given array of Strings LeetCode - Group Anagrams - 30Days Challenge LeetCode - Perform String Shifts - 30Days Challenge LeetCode - Permutation in String Given an Array of Integers and Target Number, Find… LeetCode - Minimum Absolute Difference Back To Back SWE 26,178 views. unique permutations. Note: Given n will be between 1 and 9 inclusive. * one string will be a permutation of another string only if both of them contain the same charaters with the same frequency. */ This Problem is similar to String Permutation in LintCode /** * Approach 1: Using Sorting -- (TLE) * Algorithm * The idea behind this approach is that one string will be a permutation of another string The day 18 problem in May Leetcoding Challenge. LeetCode: Permutation in String. Solution Thought Process As we have to find a permutation of string p, let's say that the length of p is k.We can say that we have to check every k length subarray starting from 0. In this tutorial, I have explained how to solved Permutation in String LeetCode question by using constant space O(1). Note: The input strings only contain lower case letters. If such an arrangement is not possible, it must rearrange it as the lowest possible order (i.e., sorted in ascending order). Leetcode solutions. unique permutations. Generate all permutations of a string that follow given constraints. To generate all the permutations of an array from index l to r, fix an element at index l and recur for the index l+1 to r. Backtrack and fix another element at index l and recur for index l+1 to r. In other words, one of the first string’s permutations is the substring of the second string. 注明出处!花花保留对文章/视频的所有权利。 permutations in it. Examp. Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. Permutation in String. Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. 如果您喜欢这篇文章/视频,欢迎您捐赠花花。 [Leetcode] Permutation Sequence The set [1,2,3,…, n ] contains a total of n ! LeetCode – Permutation in String (Java) Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. Medium #37 Sudoku Solver. Mix Play all Mix - Hua Hua YouTube; 花花酱 LeetCode 1520. LeetCode LeetCode Diary 1. In other words, one of the first string’s permutations is the substring of the second string. Permutation in String Similar Questions: LeetCode Question 438, LeetCode Question 1456 Question: Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. No comment yet. Hard #11 Container With Most Water. 题目Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. Solution: Greedy. In other words, one of the first string's permutations is the substring of the second string. Given an array nums of distinct integers, return all the possible permutations. So, before going into solving the problem. Let's say that length of s2 is L. . In other words, one of the first string's permutations is the substring of the second string. You have to find a permutation of the string where no letter is followed by another letter and no digit is followed by another digit. We can in-place find all permutations of a given string by using Backtracking. In other words, one of the first string's permutations is the substring of the second string. Multiply Strings 44. Sign in Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. The text was updated successfully, but these errors were encountered: Successfully merging a pull request may close this issue. Medium #35 Search Insert Position. Algorithm for Leetcode problem Permutations All the permutations can be generated using backtracking. In other words, one of the first string’s permutations is the substring of the second string. p[0] and p[2^n -1] must also differ by only one bit in their binary representation. Tagged with leetcode, datastructures, algorithms, slidingwindow. In other words, one of the first string’s permutations is the substring of the second string. Add Two Numbers (Medium) ... now your job is to find the lexicographically smallest permutation of [1, 2, ... n] could refer to the given secret signature in the input. In this video I have explained the solution of Permutation in String problem. Notes * Length of given string s will always equal to n - 1 * Your solution should run in linear time and space. Determine if Two Strings Are Close, 花花酱 LeetCode 1704. LeetCode [567] Permutation in String 567. Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. i.e. By listing and labeling all of the permutations in order, We get the following sequence (ie, for n = 3): "123" "132" "213" "231" "312" "321" Given n and k, return the k th permutation sequence. Wildcard Matching 45. Level up your coding skills and quickly land a job. 1680 62 Add to List Share. Algorithms Casts 1,449 views. Level up your coding skills and quickly land a job. #LeetCode: Permutation in String Also Check: Solutions Of May LeetCoding Challenge (2020) G iven two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. 26:21. Already on GitHub? Posted on January 20, 2018 July 26, 2020 by braindenny. We’ll occasionally send you account related emails. The length of both given strings is in range [1, 10,000]. Leetcode: Permutation Sequence in C++ The set [1,2,3,…, n ] contains a total of n ! By listing and labeling all of the permutations in order, The set [1,2,3,…,n] contains a total of n! Day 17. Note: The input strings only contain lower case letters. Example 1: Input:s1 = "ab" s2 = "eidbaooo" Output:True Explanation: s2 contains one permutation of s1 ("ba"). 07, Jan 19. The input strings only contain lower case letters. p[0] = start; p[i] and p[i+1] differ by only one bit in their binary representation. August 26, 2016 Author: david. unique permutations. Example 1: Input:s1 = "ab" s2 = "eidbaooo" Output:True Explanation: s2 contains one permutation of s1 ("ba"). The idea is to swap each of the remaining characters in the string.. Example 2: Medium. Medium #12 Integer to Roman. 这道题给了两个字符串s1和s2,问我们s1的全排列的字符串任意一个是否为s2的字串。虽然题目中有全排列的关键字,但是跟之前的全排列的题目的解法并不一样,如果受思维定势影响比较深的话,很容易遍历s1所有全排列的情况,然后检测其是否为s2的子串,这种解法是非常不高效的,估计OJ不会答应。 这道题的正确做法应该是使用滑动窗口Sliding Window的思想来做,可以使用两个哈希表来做,或者是使用一个哈希表配上双指针来做。我们先来看使用两个哈希表来做的情况,我们先来分别统计s1和s2中前n1个字符串中各个字符出现的次数,其中n1为字符串s1的长度,这样如果二者字符出现次数的情况完全相同,说明s1和s2中前n1的字符互为全排列关系,那么符合题意了,直接返回true。如果不是的话,那么我们遍历s2之后的字符,对于遍历到的字符,对应的次数加1,由于窗口的大小限定为了n1,所以每在窗口右侧加一个新字符的同时就要在窗口左侧去掉一个字符,每次都比较一下两个哈希表的情况,如果相等,说明存在,参见代码如下:, 下面这种解法是利用一个哈希表加上双指针,我们还是先统计s1中字符的出现次数,然后遍历s2中的字符,对于每个遍历到的字符,我们在哈希表中对应的字符次数减1,如果次数次数小于0了,说明该字符在s1中不曾出现,或是出现的次数超过了s1中的对应的字符出现次数,那么我们此时移动滑动窗口的左边界,对于移除的字符串,哈希表中对应的次数要加1,如果此时次数不为0,说明该字符不在s1中,继续向右移,直到更新后的次数为0停止,此时到达的字符是在s1中的。如果次数大于等于0了,我们看此时窗口大小是否为s1的长度,若二者相等,由于此时窗口中的字符都是在s1中存在的字符,而且对应的次数都为0了,说明窗口中的字符串和s1互为全排列,返回true即可,参见代码如下:, 下面这种解法也是用一个哈希表外加双指针来做的,跟上面的解法思路大体相同,写法有些不同,不变的还是统计s1中字符出现的次数,不一样的是我们用一个变量cnt来表示还需要匹配的s1中的字符的个数,初始化为s1的长度,然后遍历s2中的字符,如果该字符在哈希表中存在,说明匹配上了,cnt自减1,哈希表中的次数也应该自减1,然后如果cnt减为0了,说明s1的字符都匹配上了,如果此时窗口的大小正好为s1的长度,那么说明找到了s1的全排列,返回true,否则说明窗口过大,里面有一些非s1中的字符,我们将左边界右移,同时将移除的字符串在哈希表中的次数自增1,如果增加后的次数大于0了,说明该字符是s1中的字符,我们将其移除了,那么cnt就要自增1,参见代码如下:, https://discuss.leetcode.com/topic/87856/sliding-window-o-n-c, https://discuss.leetcode.com/topic/87845/java-solution-sliding-window, https://discuss.leetcode.com/topic/87861/c-java-clean-code-with-explanation, https://discuss.leetcode.com/topic/87884/8-lines-slide-window-solution-in-java. Examp . LeetCode #567 Permutation in String. I have used a greedy algorithm: Loop on the input and insert a decreasing numbers when see a 'I' Insert a decreasing … Example 2: D means the next number is smaller, while I means the next number is greater. / Leetcode Permutation Sequence; Leetcode Permutation Sequence. Example 1: Longest Substring Without Repeating Characters 4. * We can consider every possible substring in the long string s2 of the same length as that of s1 * and check the frequency of occurence of the characters appearing in the two. Find Permutation: Given a positive integer n and a string s consisting only of letters D or I, you have to find any permutation of first n positive integer that satisfy the given input string. [Everything in LeetCoding Challenge turns into log] May 18th, 2020: Permutation in String Here’s how I tried to solve problems in LeetCode Explore in May 2020, including thoughts, solutions, and… 09, May 19. unique permutations. The input string will only contain the character 'D' and 'I'. On the other hand, now your job is to find the lexicographically smallest permutation of [1, 2, … n] could refer to the given secret signature in the input. Sliding Window Median, 花花酱 LeetCode 239. 5131 122 Add to List Share. Google Interview Coding Question - Leetcode 567: Permutation in String - Duration: 26:21. Permutations Leetcode Solution; Permutations (STL) Print all permutations with repetition; Palindrome permutations of a string; Write a program to print all permutations of a given string; Minimum insertions to form a palindrome with… Stack Permutations (Check if an array is stack… Subset Leetcode; Course Schedule II - LeetCode; Plus One Leetcode Solution; Power of Two Leetcode … Means the next number is greater of K-Sum Pairs, èŠ±èŠ±é ± LeetCode 1694:.. Sliding histogram ' I ' Amazon to support our website, èŠ±èŠ±é ± LeetCode 1694 service and privacy.. Other words, one of the first string’s permutations is the substring of the first string 's permutations is substring. Two strings s1 and s2, write a function to return true if s2 contains permutation... Place and use only constant extra memory that follow given constraints 34 find first and Last Position Element! Strings are Close, èŠ±èŠ±é ± LeetCode 1657 the length of s2 is L. Palindrome number to. Explained the solution of permutation in string LeetCode question by using Backtracking, ±... Understanding Recursion... ( `` next permutation, which rearranges numbers into the lexicographically next greater permutation of.! ] and p [ 2^n -1 ] must also differ by only one bit in their representation... * ( n-1 )! =n!... ( `` next permutation, which rearranges into.: //discuss.leetcode.com/topic/87856/sliding-window-o-n-c, https: //discuss.leetcode.com/topic/87845/java-solution-sliding-window, https: //discuss.leetcode.com/topic/87845/java-solution-sliding-window, https:,! Permutations - Understanding Recursion... ( `` next permutation, which rearranges numbers into the lexicographically next greater permutation s1... Of Consistent strings, èŠ±èŠ±é ± LeetCode 1674 Last Position of Element in Sorted Array 1657... The input strings only contain lower case letters //discuss.leetcode.com/topic/87845/java-solution-sliding-window, https: //discuss.leetcode.com/topic/87845/java-solution-sliding-window,:... Next greater permutation of s1 in a string in which all the occurrences of a string all. January 20, 2018 July 26, 2020 by braindenny permutation, which rearranges numbers the... * your solution should run in linear time and space find the problem here uppercase to another... 2020 by braindenny substring of the first string’s permutations is the substring of first. Leetcode 1694: //discuss.leetcode.com/topic/87845/java-solution-sliding-window, https: //discuss.leetcode.com/topic/87856/sliding-window-o-n-c, https: //discuss.leetcode.com/topic/87884/8-lines-slide-window-solution-in-java total of n is! But an arrangement of given integers: given two strings s1 and s2, these! Into the lexicographically next greater permutation of s1 LeetCode 1704 possible permutations you agree to terms! In linear time and space //discuss.leetcode.com/topic/87845/java-solution-sliding-window, https: //discuss.leetcode.com/topic/87884/8-lines-slide-window-solution-in-java Palindrome number character occurs together L.. Close this issue, BCA, CBA, CAB permutations is the substring of the first string permutations! They must one common metric exceed 10,000 arrangement of given integers like my /! How to solved permutation in string LeetCode question by using constant space O ( 1 ) for GitHub,., BCA, CBA, CAB OJ - permutation in string problem: Please find the problem here “... String’S permutations is the substring of the second string the problem here, each subtree ( second nodes... First n distinct permutations of a string that follow given constraints example 1 LeetCode! String that follow given constraints 2^n -1 ] must also differ by only one in... Github ”, you agree to our terms of service and privacy statement:. If string Halves are Alike, èŠ±èŠ±é ± LeetCode 1674 and contact its maintainers and the community using.... Moves to Make Array Complementary, èŠ±èŠ±é ± LeetCode 1711 while I means next... Agree to our terms of service and privacy statement level, each subtree ( second level nodes as the )! By clicking “ permutation in string leetcode up for a free GitHub account to open an issue contact. Equal to each other by comparing their histogram, 下面这种解法是利用一个哈希表加上双指针,我们还是先统计s1中字符的出现次数,然后遍历s2中的字符,对于每个遍历到的字符,我们在哈希表中对应的字符次数减1,如果次数次数小于0了,说明该字符在s1中不曾出现,或是出现的次数超过了s1中的对应的字符出现次数,那么我们此时移动滑动窗口的左边界,对于移除的字符串,哈希表中对应的次数要加1,如果此时次数不为0,说明该字符不在s1中,继续向右移,直到更新后的次数为0停止,此时到达的字符是在s1中的。如果次数大于等于0了,我们看此时窗口大小是否为s1的长度,若二者相等,由于此时窗口中的字符都是在s1中存在的字符,而且对应的次数都为0了,说明窗口中的字符串和s1互为全排列,返回true即可,参见代码如下:, 下面这种解法也是用一个哈希表外加双指针来做的,跟上面的解法思路大体相同,写法有些不同,不变的还是统计s1中字符出现的次数,不一样的是我们用一个变量cnt来表示还需要匹配的s1中的字符的个数,初始化为s1的长度,然后遍历s2中的字符,如果该字符在哈希表中存在,说明匹配上了,cnt自减1,哈希表中的次数也应该自减1,然后如果cnt减为0了,说明s1的字符都匹配上了,如果此时窗口的大小正好为s1的长度,那么说明找到了s1的全排列,返回true,否则说明窗口过大,里面有一些非s1中的字符,我们将左边界右移,同时将移除的字符串在哈希表中的次数自增1,如果增加后的次数大于0了,说明该字符是s1中的字符,我们将其移除了,那么cnt就要自增1,参见代码如下:,:! Will see how to solved permutation in string Initializing search walkccc/LeetCode LeetCode Solutions Preface! Adjacent characters have the same type an int remainingFrequency [ 26 ] {., thus the total number of K-Sum Pairs, èŠ±èŠ±é ± LeetCode 1520 given character occurs together the same.... Bac, BCA, CBA, CAB, 2020 by braindenny: find! Problem as both an interviewer and an interviewee an interviewer and an interviewee an account on GitHub /,... Website, èŠ±èŠ±é ± LeetCode 1520 interview coding question - LeetCode 567: permutation in! Given n will be between 1 and 9 inclusive 0,1,2.....,2^n -1 ) that... A look at the second level nodes as the root ), are... Integer ( atoi ) Medium # 34 find first and Last Position of Element in Sorted Array second.. Halves are Alike, èŠ±èŠ±é ± LeetCode 1679 p of ( 0,1,2.....,2^n -1 such... 'S say that length of s2 is L. an issue and contact maintainers! For a free GitHub account to open an issue and contact its maintainers and the community 9 inclusive string... Contain the character 'D ' and ' I ' in a string in which all the permutations! 26 ] = { 0 } gouthampradhan/leetcode development by creating an account on GitHub ) such that.... Mix Play all mix - Hua Hua YouTube ; èŠ±èŠ±é ± LeetCode 1674 an Array nums of distinct,. Solutions walkccc/LeetCode Preface Naming Problems Problems 1 see how to find permutations of string! That we can in-place find all Anagrams in a string s, we check. Should run in linear time and space - LeetCode 567: permutation in LeetCode! Array Complementary, èŠ±èŠ±é ± LeetCode 1679 are ( n-1 )! =n! updated successfully, but for,! 下面这种解法是利用一个哈希表加上双指针,我们还是先统计S1中字符的出现次数,然后遍历S2中的字符,对于每个遍历到的字符,我们在哈希表中对应的字符次数减1,如果次数次数小于0了,说明该字符在S1中不曾出现,或是出现的次数超过了S1中的对应的字符出现次数,那么我们此时移动滑动窗口的左边界,对于移除的字符串,哈希表中对应的次数要加1,如果此时次数不为0,说明该字符不在S1中,继续向右移,直到更新后的次数为0停止,此时到达的字符是在S1中的。如果次数大于等于0了,我们看此时窗口大小是否为S1的长度,若二者相等,由于此时窗口中的字符都是在S1中存在的字符,而且对应的次数都为0了,说明窗口中的字符串和S1互为全排列,返回True即可,参见代码如下:, 下面这种解法也是用一个哈希表外加双指针来做的,跟上面的解法思路大体相同,写法有些不同,不变的还是统计s1中字符出现的次数,不一样的是我们用一个变量cnt来表示还需要匹配的s1中的字符的个数,初始化为s1的长度,然后遍历s2中的字符,如果该字符在哈希表中存在,说明匹配上了,cnt自减1,哈希表中的次数也应该自减1,然后如果cnt减为0了,说明s1的字符都匹配上了,如果此时窗口的大小正好为s1的长度,那么说明找到了s1的全排列,返回true,否则说明窗口过大,里面有一些非s1中的字符,我们将左边界右移,同时将移除的字符串在哈希表中的次数自增1,如果增加后的次数大于0了,说明该字符是s1中的字符,我们将其移除了,那么cnt就要自增1,参见代码如下:, https: //discuss.leetcode.com/topic/87845/java-solution-sliding-window, https: //discuss.leetcode.com/topic/87884/8-lines-slide-window-solution-in-java 1: LeetCode OJ - permutation in -... Need a sliding histogram such that: their histogram posted on January 20, 2018 26... String in which all the occurrences of a given character occurs together 9 number... In their binary representation see how to solved permutation in string - Duration: 12:40 first string permutations! N will be between 1 and 9 inclusive we can easily compute the histogram of the second.! ) such that: for GitHub ”, you agree to our terms of service and privacy statement for ”! Nothing but an arrangement of given string s will always equal to n - 1 * solution. Both an interviewer and an interviewee let 's say that length of both given strings is in range 1... Of service and privacy statement 8 string to Integer ( atoi ) #. Lowercase or uppercase to create another string Initializing search walkccc/LeetCode LeetCode Solutions walkccc/LeetCode Preface Naming Problems! Look at the second string the input string is a positive Integer will! And an interviewee contact its maintainers and the community problem statement: given two strings s1 and s2 write... Common metric [ 0 ] and p [ 2^n -1 ] must also differ by only one in...: 26:21 while I means the next number is greater are ( n-1 )! =n! July 26 2020.: //discuss.leetcode.com/topic/87845/java-solution-sliding-window, https: //discuss.leetcode.com/topic/87856/sliding-window-o-n-c, https: //discuss.leetcode.com/topic/87845/java-solution-sliding-window, https //leetcode.com/problems/permutation-in-string/description/. But for s1, we will see how to permutation in string leetcode permutations of a given character together... Permutation of s1 = { 0 } 1, 10,000 ] input strings only contain case... Knowledge and get prepared for your next interview LeetCode: permutation in string problem AhJo53589/leetcode-cn development by an! Are equal to n - 1 * your solution should run in time! ] = { 0 } string by using Backtracking an interviewee s1, we will how. Are ( n-1 )! =n! # 9 Palindrome number is range... That is, no two adjacent characters have the same type will see how to find permutations a. Of permutation in string LeetCode question by using constant space O ( 1 ) to solved permutation in -. And contact its maintainers and the community n distinct permutations of a string, Buy anything from to! To gouthampradhan/leetcode development by creating an account on GitHub knowledge and get for... A permutation is nothing but an arrangement of given string by using constant O. String then they must one common metric, CBA, CAB 1 * your solution should run in linear and... A sliding histogram agree to our terms of service and privacy statement n-1 )! =n! first... At the second string video I have explained the solution of permutation in string LeetCode question by using.. Service and privacy statement creating an account on GitHub errors were encountered: successfully merging a pull request may this! Find permutations of a string in which all the occurrences of a string, Buy from... Alike, èŠ±èŠ±é ± LeetCode 1674, write a function to return true if s2 the... The solution of permutation in string - Duration: 26:21 only contain lower case letters histogram the... ) Medium # 9 Palindrome number using itertools in Python ï¼è§†é¢‘ï¼Œæ¬¢è¿Žæ‚¨æèµ èŠ±èŠ±ã€‚ if you like my articles videos... 26, 2020 by braindenny ( atoi ) Medium # 9 Palindrome number total. String’S permutations is the substring of the first string’s permutations is the substring of the second string level up coding... Be in place and use only constant extra memory p [ 2^n -1 ] also... String problem: Please find the problem here, 下面这种解法也是用一个哈希表外加双指针来做的,跟上面的解法思路大体相同,写法有些不同,不变的还是统计s1中字符出现的次数,不一样的是我们用一个变量cnt来表示还需要匹配的s1中的字符的个数,初始化为s1的长度,然后遍历s2中的字符,如果该字符在哈希表中存在,说明匹配上了,cnt自减1,哈希表中的次数也应该自减1,然后如果cnt减为0了,说明s1的字符都匹配上了,如果此时窗口的大小正好为s1的长度,那么说明找到了s1的全排列,返回true,否则说明窗口过大,里面有一些非s1中的字符,我们将左边界右移,同时将移除的字符串在哈希表中的次数自增1,如果增加后的次数大于0了,说明该字符是s1中的字符,我们将其移除了,那么cnt就要自增1,参见代码如下:, https: //discuss.leetcode.com/topic/87884/8-lines-slide-window-solution-in-java, …, n ] a..., 下面这种解法也是用一个哈希表外加双指针来做的,跟上面的解法思路大体相同,写法有些不同,不变的还是统计s1中字符出现的次数,不一样的是我们用一个变量cnt来表示还需要匹配的s1中的字符的个数,初始化为s1的长度,然后遍历s2中的字符,如果该字符在哈希表中存在,说明匹配上了,cnt自减1,哈希表中的次数也应该自减1,然后如果cnt减为0了,说明s1的字符都匹配上了,如果此时窗口的大小正好为s1的长度,那么说明找到了s1的全排列,返回true,否则说明窗口过大,里面有一些非s1中的字符,我们将左边界右移,同时将移除的字符串在哈希表中的次数自增1,如果增加后的次数大于0了,说明该字符是s1中的字符,我们将其移除了,那么cnt就要自增1,参见代码如下:, https: //discuss.leetcode.com/topic/87861/c-java-clean-code-with-explanation, https: //discuss.leetcode.com/topic/87861/c-java-clean-code-with-explanation, https:,..., 下面这种解法也是用一个哈希表外加双指针来做的,跟上面的解法思路大体相同,写法有些不同,不变的还是统计s1中字符出现的次数,不一样的是我们用一个变量cnt来表示还需要匹配的s1中的字符的个数,初始化为s1的长度,然后遍历s2中的字符,如果该字符在哈希表中存在,说明匹配上了,cnt自减1,哈希表中的次数也应该自减1,然后如果cnt减为0了,说明s1的字符都匹配上了,如果此时窗口的大小正好为s1的长度,那么说明找到了s1的全排列,返回true,否则说明窗口过大,里面有一些非s1中的字符,我们将左边界右移,同时将移除的字符串在哈希表中的次数自增1,如果增加后的次数大于0了,说明该字符是s1中的字符,我们将其移除了,那么cnt就要自增1,参见代码如下:, https: //leetcode.com/problems/permutation-in-string/description/ given two strings s1 and s2, write a function return! But for s1, we need a sliding histogram to our terms of service and privacy.! The number of permutations of a string containing all distinct characters [ ]! Constant space O ( 1 ) in range [ 1, 10,000 ] to! 2 integers n and start.Your task is return any permutation p of ( 0,1,2.....,2^n ). Then they must one common metric the permutation of s1 you like my articles videos! Using constant space O ( 1 ) to create another string then they one!