DEV Community

Cover image for BigBrainKotlin#4 | Among Us
Chetan garg
Chetan garg

Posted on • Originally published at chetangupta.net

BigBrainKotlin#4 | Among Us

Don't be a Java-ish dev in Kotlin-ish world, improve your knowledge about Koltin Standard Library and write better Kotlin code. ✌🏻 If your Java dev migrating to Kotlin this will help you learn alot!

BBK Special

The aim of these articles is not hate on Java, but to help people learn various ways in which they can write the same logic better and more Kotlin standard library focused way.

Question:
Find the imposter from the given array with at least 3 items, it's either entirely comprised of odd integers or entirely comprised of even integers except for a single integer N. Write a method that takes the array as an argument and returns this "Imposter" N...

imposter(arrayOf(2,6,8,-10,3)) => returns 3

imposter(arrayOf(206847684,1056521,7,17,1901,21104421,7,1,35521,1,7781)) => returns 206847684

imposter(arrayOf(Integer.MAX_VALUE, 0, 1))=> returns 0
Enter fullscreen mode Exit fullscreen mode

Try it out yourself, or submit it in the comments before checking out my solutions.

👉 BigBrainKotlin#4

Hope to see you on the other side...

Until next time. Happy Hacking! 👩‍💻

Stalk Me 👀 :
LinkedIn | Medium | Twitter | StackOverflow | CodeWars |WorkX |Github |Instagram |Youtube

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️