Logic and working is clear but just one doubt that what condition is used in for loop to get elements of array list cause till now we are only using conditions like for(i=0, I<10, I++) (just a basic example) . But mam used for (string rrs:rr) what this means please tell in detail like what is this how it works.
Get permetuation
@deepanshu_123 Hey buddy, nothing much just we are using for each loop here.
So basically what it is doing is it is just iterating over the arraylist of strings and giving you each string element from it.
We can use it when:-
- we donβt have to modify the elements in our list.
- we donβt have to keep track of index.
- Also when we have to traverse only in forward order not reverse.
So here we have to just access the Strings stored in list so we are using it.
Bro if your query is clear, do close the doubt marking it resolved and rate full!