Skip to content

Full stack live coding exercise inspired by batching

Notifications You must be signed in to change notification settings

rhinofi/batching_challenge

Repository files navigation

RhinoFi backend challenge

Batching challenge

The goal of this exercise is as follows:

  • Read a CSV file (check records.csv for format)
  • Parse the records and use SIZE_MAPPINGS to convert each character to a weight, sum them up per row to get the total weight of the row
  • Group rows sequentially by how many can fit within the maxSize
  • First column is the id of the row which must be in the output
  • Optional improvement: entire CSV file cannot file within memory ensure the logic can handle such a case

Example

maxSize = 30
SIZE_MAPPINGS = {
  A: 4,
  B: 5,
  C: 6,
  D: 7,
}

// CSV
0,D:D:C     --> value = 20
1,B:B       --> value = 10
2,D:D:B:B   --> value = 24

// Expected result
[
  [0, 1],   --> rows 0 and 1 based on their id
  [2],
]

About

Full stack live coding exercise inspired by batching

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published