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

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay