Reverse a subrange
Java
Medium
5 views
Problem Description
Task: reverse elements between l and r inclusive.
Output Format
In-place update
Official Solution
static void reverseRange(int[] a,int l,int r){while(l<r){int t=a[l];a[l]=a[r];a[r]=t;l++;r--;}}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!