Round exercise 3. Lessons learned from 80 attempts (10 min) (5 min) (10 min) What makes for a good onsite coding exercise? What makes for a good onsite coding exercise?
cost will be 40% of the chosen plan. E.g., for a Garage Plan ($30), the price of materials we intend to charge will be $12. For marketing purposes, we would like to round the price of materials to the closest integer amount that either ends with a 4 or with a 9. In other words, rather than $12 we would charge $14. Here are more examples: How would you implement such a method? You can use any programming language. $8 becomes $9 $9 becomes $9 $10 becomes $9 $11 becomes $9 $12 becomes $14 $13 becomes $14 $14 becomes $14 $15 becomes $14 The Retail Round exercise What makes for a good onsite coding exercise?
cost will be 40% of the chosen plan. E.g., for a Garage Plan ($30), the price of materials we intend to charge will be $12. For marketing purposes, we would like to round the price of materials to the closest integer amount that either ends with a 4 or with a 9. In other words, rather than $12 we would charge $14. Here are more examples: How would you implement such a method? You can use any programming language. $8 becomes $9 $9 becomes $9 $10 becomes $9 $11 becomes $9 $12 becomes $14 $13 becomes $14 $14 becomes $14 $15 becomes $14 The Retail Round exercise is contextual What makes for a good onsite coding exercise?
cost will be 40% of the chosen plan. E.g., for a Garage Plan ($30), the price of materials we intend to charge will be $12. For marketing purposes, we would like to round the price of materials to the closest integer amount that either ends with a 4 or with a 9. In other words, rather than $12 we would charge $14. Here are more examples: How would you implement such a method? You can use any programming language. $8 becomes $9 $9 becomes $9 $10 becomes $9 $11 becomes $9 $12 becomes $14 $13 becomes $14 $14 becomes $14 $15 becomes $14 The Retail Round exercise is conversational What makes for a good onsite coding exercise?
cost will be 40% of the chosen plan. E.g., for a Garage Plan ($30), the price of materials we intend to charge will be $12. For marketing purposes, we would like to round the price of materials to the closest integer amount that either ends with a 4 or with a 9. In other words, rather than $12 we would charge $14. Here is my scoring rubric (out of 10 points): • 5 points for any working solution • 1 point for good data structures • 1 point for additional cases (float input) • 1 point for proving the solution is correct • 1 point for readability (variable names, …) • 1 point for extra coding skills (no copy/paste, fast typing, keyboard shortcuts, finger position) The Retail Round exercise is impartial What makes for a good onsite coding exercise?
onsite coding exercise? • Can be solved • Often in Python • Five major approaches 90% found a working solution [A] [B] [C] [D] [E] 45% Python JS Java Ruby …
- last_digit if 1.5 <= last_digit <= 6.5: closest_ten += 4 elif 0 <= last_digit < 1.5: closest_ten -= 1 else: closest_ten += 9 return int(closest_ten) for i in range(8, 16): print(charge_price(i)) assert(charge_price(11.2) == 9) Approach C: range of the last digit What makes for a good onsite coding exercise?
marketing_round(cost) ((cost + 1) * 2).round(-1) / 2 - 1 end (8..15).each do |i| puts "#{i}\t#{marketing_round(i)}" end puts marketing_round(11.2) Approach E: mathematical round What makes for a good onsite coding exercise?