Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 417 Bytes

File metadata and controls

13 lines (10 loc) · 417 Bytes

Problem Description

Given a non-negative number up to 10 digits long, find the largest number that can be formed with the digits and is divisible by 3. If no number can be formed that is divisible by 3, return 0.

Input: int Output int

Examples:

  • largest_div_by_three(0) -> 0
  • largest_div_by_three(24) -> 42
  • largest_div_by_three(319) -> 93
  • largest_div_by_three(113) -> 3
  • largest_div_by_three(111) -> 111