Back to home page
  • Reverse Groups

    Sponsoring Company:

    Challenge Description:

    Given a list of numbers and a positive integer k, reverse the elements of the list, k items at a time. If the number of elements is not a multiple of k, then the remaining items in the end should be left as is.

    Input sample:

    Your program should accept as its first argument a path to a filename. Each line in this file contains a list of numbers and the number k, separated by a semicolon. The list of numbers are comma delimited. E.g.


    Output sample:

    Print out the new comma separated list of numbers obtained after reversing. E.g.

Login to submit solution