[ java | Detailed explanation] very easy sol with step-by-step guide and intuition
  \nThere is a famous idiom in hindi which describe this problem very acurately.....  " UlTE KA ULTA = SIDHA " for the non-hindi folks it goes somewhat like -> 
<p> <img align="right" alt="Coding" width="100" src="https://assets.leetcode.com/users/images/14aea68c-f5c2-41d3-b2d2-3c8556d0d9bc_1673600276.9231472.gif"/> </p\n\n![Screenshot_20230106_091731.png](https://assets.leetcode.com/users/images/19c36e8a-0203-4d3d-8ed7-694b54b5b5b7_1673020110.2665236.png)\n\nBefore i Start see how a bracket () can take your 2 hour.....\uD83E\uDEE3\uD83D\uDE4C\n\nBTW the song is of abdul hannan.....if you are curious...\n\n    Now let\'s begin....\n# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThere is a famous idiom in hindi which describe this problem very acurately.....  " UlTE KA ULTA = SIDHA " for the non-hindi folks it goes somewhat like -> reverse of reverse is straight .\n\nsee we need to reverse the array but only k times and for that we can do one thing in bruteforce appraoch -\n     we store the left part of the k i.e from k+1 to arr.length-1 in an array and from 0 to k in  other array and then just append those two array\n  \n    obviously the interviewer will not be \uD83D\uDE00 with it and will ask you\n    to opimize it ... then you will show your skills \uD83E\uDEE1\n# Approach\n<!-- Describe your approach to solving the problem. -->\nso for optimized approach we will perform 3 step ->\n1. In first step - you will reverse the array from  0 to len-k\n2. In second step - you will reverse the array from len-k+1 to len\n3. And at last you will reverse the whole array.\n   \n# Boom you got the answer \uD83C\uDF93\n\n     well wait! there is a \uD83E\uDEB2 very dangerous \n\nwhat if we get k > then len then we will get abnormility here we will use our main weapon  -> % ( yup looks tiny but very usefull \uD83E\uDD26\u200D\u2642\uFE0F )\n\nsee when we rotate len time a array we get the array back again and thus [ k%len ] give us the exact time we have to rotate after a full rotation and for k less then len we will get k back again .\n\n     fun fact -> the hindi idiom is self made ...just like you coder \uD83D\uDC96\n\nHope you under stood it.  For any correction pls let me know...\n\n    PLEASE UP-VOTE IF IT HELPED YOU \uD83D\uDE4C  \n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n# Additionals\n-  connect with me - https://linktr.ee/_soumya\n# Code\n```\nclass Solution {\n     public int[] rotate(int[] arr, int k) {\n        int len = arr.length-1;\n        k=k%(len+1);\n        arr = rev(arr,0,len-k);\n        arr=rev(arr,len-k+1,len);\n        arr=rev(arr,0,len);\n        return arr;\n    }\n\n   public int[] rev(int[] arr,int low,int hi)\n    {\n        while(low<hi)\n        {\n           int temp=arr[low];\n           arr[low]=arr[hi];\n           arr[hi]=temp;\n           hi--;\n           low++;\n        }\n        return arr;\n    }\n}\n```
['Two Pointers', 'Java']