Picking Numbers HackerRank Exercise

Photo by Lewis Ngugi on Unsplash

Input Format

  • a: an array of integers

Constraints

  • 2 <= n <= 100
  • 0 < a[i] < 100
  • The answer will be >= 2

Solving

  • Generate array repeatingList with length 100. And set all of the items to 0. This array will contain the number of all repeating of each item.
  • For through the input array, and increment the element on an index which equal to iterable item — 1.
  • For through the repeatingList and sum each element with the next element in the sequence. The biggest met sum is our answer

My Social Media

--

--

--

iOS Software Developer

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

Recommended from Medium

A glimpse into the iOS Keychain

How to Make One Side Circular Border Of Widget In Flutter?

Meet the new fresh faces at Cobot

GitHub actions: How to improve your CI/CD workflow

FlutterForce — #Week 99

Using Quizlet to Memorise Commands, IDE Shortcuts, and other things for Software Engineers

Three myths about software development

Verifying hash with PowerShell (for terminal lovers)

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
Almost Engineer

Almost Engineer

iOS Software Developer

More from Medium

Closures In Swift And It’s Related Importance

Behavior Driven Testing in Swift with Quick and Nimble

RxSwift: Combining Operators in Practice

Best SSO Provider: Why LoginRadius Is Considered As The Best SSO Solution