There are three kinds of actuaries: those who can count, and those who can't.
There are three kinds of actuaries: those who can count, and those who can't.
Carey Brown wrote:
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:I totally underestimated the role of GCD. That made me having to save 'Shift' numbers, instead of just 1. Clever guys, these GeeksForGeeks!
But I never like methods that do a lot of this index juggling. It is often difficult to get it right and makes the code hard to follow. I mentioned a method in the Collections class, that we can use to let Java do all the hard work. The two problems (what are problems?) are that that method works with Lists, and therefore leaves the input array unmodified. But suppose we have two methods: List arrayToList(int[] array' and 'int[] listToArray(List list)' we could have:
And 'shift' can be positive or negative, to detrmine the direction of the shift.
Tushar Goel wrote:Meantime,i found another solution by recursive calls as mentioned in Programming Pearls.
Carey Brown wrote:
Tushar Goel wrote:Meantime,i found another solution by recursive calls as mentioned in Programming Pearls.
I'm curious. Could you post your code for that?
There are three kinds of actuaries: those who can count, and those who can't.
Tushar Goel wrote:Meantime,i found another solution by recursive calls as mentioned in Programming Pearls.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |