Quantcast
Channel: Programming challenge “Greatest Odd Divisor” - Code Review Stack Exchange
Browsing latest articles
Browse All 4 View Live

Answer by mdfst13 for Programming challenge “Greatest Odd Divisor”

sum = sum + GOD(i);In Java and most C-based languages, you can write this as sum += GOD(i);Which is just a shorter way of writing the same thing. This works for most arithmetic operators. import...

View Article



Answer by Martin R for Programming challenge “Greatest Odd Divisor”

First some remarks to your code (in addition to what @200_successalready said):Use more horizontal space and make the spacing consistent. if (num % i == 0 && i % 2 != 0) is better readable than...

View Article

Answer by 200_success for Programming challenge “Greatest Odd Divisor”

You should not be using doubles to perform integer arithmetic. Stick to int or long.This is a brute-force search that follows the instructions very literally. That is the wrong approach. Similar to...

View Article

Programming challenge “Greatest Odd Divisor”

I am trying to solve a programming problem on a coding platform. When I submit the code on the coding platform, it throws a "Time Limit Exceeded" error. Can someone check my solution and help optimize...

View Article
Browsing latest articles
Browse All 4 View Live




Latest Images