Category Archives: TopCoder

Topcoder: SRM 195 Div2 250pt Rounder

Pretty easy problem, though the topcoder solution was a single line which isn’t what I came up with. Reminder: Way of rounding: n = numerator d = denominator Always round up: (n+d)/d Round up by difference (n+(d/2))/d   Advertisements

Posted in TopCoder | Tagged , | Leave a comment

Topcoder: SRM 209 Div1 300pt MedalTable

I haven’t coded at work these days, and it’s a bit worrisome. Afraid my programming skills are going down the tube so I’m doing Topcoder problems (again) to brush up. And dam problem I know I could’ve done easy last … Continue reading

Posted in TopCoder | Tagged | Leave a comment

TopCoder: Ceil trick

Little tricks to help on time: To round up: aka ceil(a/b) int num = a+(b-1) / b

Posted in TopCoder | Leave a comment

Java: Quick Way to initialize arrays

Instead of: for (i = 0; i < array.length; i++) array[i] = <initValue> One can just do: Arrays.fill(array,<initValue>); Works for String[] at least.  

Posted in Coding, Java, TopCoder | Leave a comment

TopCoder: Good Question

I work through a simple TopCoder question a day and ran into this one that I liked. You can do it two ways, by regular expression or through coding logic. ¬†Originally I did it through logic and later tried out … Continue reading

Posted in Coding, TopCoder | Leave a comment