You are viewing a single comment's thread. Return to all comments →
My Java solution with o(1) time complexity and o(1) space:
public static int towerBreakers(int n, int m) { if(m == 1 || n % 2 == 0) return 2; else return 1; }
Seems like cookies are disabled on this browser, please enable them to open this website
Tower Breakers
You are viewing a single comment's thread. Return to all comments →
My Java solution with o(1) time complexity and o(1) space: