solve in java 8 in 30 min
solve in java 8
Mail - Dubey, Suryansh (Contract x → 2h 18m left O ALL Ⓡ 1 2 3 5 HackerRank Question - Sort an X hackerrank.com/test/eifsidn6q35/questions/6ln7ki1n7a8 BETA Can't read the text? Switch theme 2. Sort an Array Given an array of integers, any array element can be moved to the end in one move. Determine the minimum number of moves required to sort the array, ascending. Example: arr = [5, 1, 3, 2] • Move the value arr[2] = 3 to the end to get arr = [5, 1, 2, 3). • Move arr[0] = 5 to the end to achieve the sorted array, arr = [1, 2, 3, 5]. • The minimum number of moves required to sort the array is 2. Function Description Complete the function getMinimumMoves in the editor below. getMinimumMoves has the following C# A Autocomplete Disabled O 26 27 public static int getMinimumMoves (List<int> arr) 28 { 29 List<int> sortedArray=new List<int>(); 30 int temp=0; 31 int check=0; 32 int output=0; 33 foreach(int a in arr) 34 35 sortedArray.Add(a); Test Results Custom Input Run Code Compiled successfully. All available test cases passed Test case 0 Your Output (stdout) 1 0 Test case 1 Test case 2 8 Expected Output 1 Test case 3 Info O www. X 12 O: 0 0 ? : Run Tests Line: 33 Col: 30 Submit Download
Mail - Dubey, Suryansh (Contract x → 2h 18m left O ALL Ⓡ 1 2 3 5 HackerRank Question - Sort an X hackerrank.com/test/eif
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Mail - Dubey, Suryansh (Contract x → 2h 18m left O ALL Ⓡ 1 2 3 5 HackerRank Question - Sort an X hackerrank.com/test/eif
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!