[LeetCode]#1025. Divisor Game

  • Choosing any x with 0 < x < N and N % x == 0.
  • Replacing the number N on the chalkboard with N - x.
Input: 2
Output: true
Explanation: Alice chooses 1, and Bob has no more moves.
Input: 3
Output: false
Explanation: Alice chooses 1, Bob chooses 1, and Alice has no more moves.
  1. If input % 2 =0, return True.
  2. If input %2 !=0, return False.
class Solution:
def divisorGame(self, N: int) -> bool:
return N%2==0

--

--

--

Interesting in any computer science.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Using Notion To Build My Portfolio As A Software Engineer 🖊️

Learning Python 10 minutes a day #15

LINQ in C# Explained In Five Minutes

GitHub Apps in Golang

Made a Robot that gets you the Lyrics to the current Top 40 songs.

How to install VestaCP on CentOS 7

Type Inference in Luau

Demystifying @decorators in Python

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Fatboy Slim

Fatboy Slim

Interesting in any computer science.

More from Medium

LeetCode Patterns Adventure 26 — Merge Two Binary Trees

Hackerrank — Merge Sorted Linked list walkthrough #Python #Hackerrank

Solving Array problems in O(n) time and O(1) space

[LeetCode]#2114. Maximum Number of Words Found in Sentences