in Algorithms edited by
393 views
2 votes
2 votes

in Algorithms edited by
393 views

3 Comments

it is indirectly asking to compute whether one string is the anagram of the other, whose time complexity is O(n).

https://www.geeksforgeeks.org/check-whether-two-strings-are-anagram-of-each-other/

0
0
Got it thanks
0
0
Simply we can do it like this

Take an array of index a to z and initialize value of each element as 0

Then, Compare each element of 1st string with array elements

Where u got a match , make value as +1 for that element

Now compare the second string and make when get a match, make that element-1

Like that, if all letter of 1st string match with letters of 2nd string, finally value of all array element will be 0
0
0

Please log in or register to answer this question.