Why not use "log"and "substraction" operator and consider some special cases separately?

  • 5

    And then the solution will be trivial, if it's allowed :)

  • 0

    I personally consider it as a cheat. However, during the interview, you might discuss all possible ways to solve this problem with interviewer. Finally he/she will ask you to implement one of them. However, Leetcode is an practice platform, you can try all different method as you want.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.