Thirty words is too much to describe something that lasted fifteen minutes. Responsibilities on a position I applied to was not matching my expectations. How many more words one two three four
I applied online. I interviewed at Datamole in May 2024
Interview
I applied online. Got a programming assignment to complete. After spending almost 10 hours on it, I submitted it finally taking care of all necessary corner cases I think of, any optimisations, etc. Never heard back from the company regarding the result.
Interview questions [1]
Question 1
Rust coding assignment:
Implement a struct RollingStats for computing various statistics over a window of the most recent values:
- Initialise with a nonzero window size and an endianness type (either little or big).
- Accept i32 numbers in the form of a sequence of bytes in the specified endianness.
- The struct implements the std::io::Write trait when the library is build with std feature flag.
- At any point in time, it provides methods for computing:
- - Arithmetic mean (f32)
- -Standard deviation (f32)
- -A sample value from the standard distribution with the mean and standard deviation from the above points (f32)
The statistics are computed from the most recent values up to the window size. If there are fewer numbers, then all available values are used. Numbersolder than the window size should be discarded.
Write the code to be panic-free and/or briefly comment on why a potentially panicking expression can’t panic in your code.
Focus on performance and efficiency but do not sacrifice readability or safety.
Add tests to your code.
You are allowed to use any dependency from crates.io: Rust Package Registry .
Bonus: It should correctly handle "incomplete" numbers, which are completed in the next write call. For example, in sequence 1, 2, 3, the number 2 might be split such that the first two bytes are trailing in the first write call and the last two bytes are at the beginning of the next write call.
Implement this in the form of a library and publish it as a Git repository. Make the library usable in no_std environment.
Example:
1. let mut stats = None; // Initialize RollingStats with window 3 and big endianness
2. assert!(stats.write(&[0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 4]).is_ok());
3. assert_eq!(stats.mean(), 3.0);