Skip to content

NageshSingh-VidyaMantra/Reverse-array-in-groups-Nagesh-Singh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Reverse-array-in-groups-Nagesh-Singh

Given an array arr[] of positive integers of size N. Reverse every sub-array group of size K.

Note: If at any instance, there are no more subarrays of size greater than or equal to K, then reverse the last subarray (irrespective of its size).

Input & output:

Input: N = 5, K = 3 arr[] = {1,2,3,4,5} Output: 3 2 1 5 4 Explanation: First group consists of elements 1, 2, 3. Second group consists of 4,5.

**Steps to run on VS **

  1. Solution provided in Reverse_array_in_groups.js File
  2. git clone the project
  3. run the code in VS using command
  4. node Reverse_array_in_groups.js 5 3 1,2,3,4,5

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published