Skip to main content
Tweeted twitter.com/#!/StackCodeReview/status/543293727260028929
edited tags
Link
nhgrif
  • 25.3k
  • 3
  • 63
  • 129
input/output
Source Link
rolfl
  • 97.5k
  • 17
  • 218
  • 418

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. input: 1,2,3,4,5;2 1,2,3,4,5;3

1,2,3,4,5;2
1,2,3,4,5;3

Output sample:

Print out the new comma separated list of numbers obtained after reversing. E.g. 2,1,4,3,5 3,2,1,4,5

2,1,4,3,5
3,2,1,4,5

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. input: 1,2,3,4,5;2 1,2,3,4,5;3

Output sample:

Print out the new comma separated list of numbers obtained after reversing. E.g. 2,1,4,3,5 3,2,1,4,5

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. input:

1,2,3,4,5;2
1,2,3,4,5;3

Output sample:

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

2,1,4,3,5
3,2,1,4,5
deleted 17 characters in body
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237

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

INPUT SAMPLE:Input sample:

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

E.g. INPUTinput: 1,2,3,4,5;2 1,2,3,4,5;3

OUTPUT SAMPLE:Output sample:

Print out the new comma separated list of numbers obtained after reversing. E.g. 2,1,4,3,5 3,2,1,4,5

The Challenge instructions 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. INPUT: 1,2,3,4,5;2 1,2,3,4,5;3

OUTPUT SAMPLE: Print out the new comma separated list of numbers obtained after reversing. E.g. 2,1,4,3,5 3,2,1,4,5

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. input: 1,2,3,4,5;2 1,2,3,4,5;3

Output sample:

Print out the new comma separated list of numbers obtained after reversing. E.g. 2,1,4,3,5 3,2,1,4,5

Source Link
Yan
  • 683
  • 5
  • 18
Loading