theamitswami
BAN USER1 Firat Sort all the strings then
2.1) If x, y and z are same, we can simply print any of them as common element and move ahead in all three arrays.
2.2) Else If x < y, we can move ahead in ar1[] as x cannot be a common element 3) Else If y < z, we can move ahead in ar2[] as y cannot be a common element 4) Else (We reach here when x > y and y > z), we can simply move ahead in ar3[] as z cannot be a common element.
1. First traverse the array to find the position of space as space position would be number of small characters +1.
2.now just again traverse the array and start from begining and pos[space+1]if find small char put before space.else put after space.
3.With this thier is no extra space an also in O(n).I hope you understand it.
1. First traverse the array to find the position of space as space position would be number of small characters +1.
2.now just again traverse the array and start from begining and pos[space+1]if find small char put before space.else put after space.
3.With this thier is no extra space an also in O(n).I hope you understand it.
1 First Sort the arrays.
- theamitswami April 07, 20172.1) If x, y and z are same, we can simply print any of them as common element and move ahead in all three arrays.
2.2) Else If x < y, we can move ahead in ar1[] as x cannot be a common element 3) Else If y < z, we can move ahead in ar2[] as y cannot be a common element 4) Else (We reach here when x > y and y > z), we can simply move ahead in ar3[] as z cannot be a common element.