| 15 | class Solution { |
| 16 | public: |
| 17 | int gcd(int a, int b) { |
| 18 | if ( a < b ) { |
| 19 | // make a the larger one |
| 20 | int tmp = b; |
| 21 | b = a; |
| 22 | a = tmp; |
| 23 | } |
| 24 | while (b != 0) { |
| 25 | int remaind = a % b; |
| 26 | a = b; |
| 27 | b = remaind; |
| 28 | } |
| 29 | return a; |
| 30 | } |
| 31 | |
| 32 | /// how to use 2 integers to represent a double |
| 33 | /// if 0 -> up = 0, do not represent inf |
nothing calls this directly
no outgoing calls
no test coverage detected