Home
Mahendran
Cancel

Sock merchant problem - Hackerrank

Problem definition is available here This is a classification problem where the element can repeat multiple times in the given array. Like any other problem, this can be solved in multiple ways i...

Drawing book problem - Hackerrank

Problem statement is available here This problem needs minimum number of turns required to reach a particular page. Input All the books start with page1 on the left and may or may not fill the le...

Kotlin value class

Kotlin’s data class is a fan favorite when it comes to storing any model. Bundled with bunch of necessary methods, devs get a lot while writing way less. From Kotlin 1.5 — we have value class-s. L...

Hackerrank - bon-appetit problem solution in Kotlin

1. sumBy 2. sumOf 3. foldIndexed 4. reduceIndexed 5. filterIndexed + sum() 6. fold 7. reduce Solution: For detailed problem statement, head over to the bill division problem here...

Electronic store problem - Hackerrank - Kotlin solution - elimination approach

Introduction Problem definition is available here Our goal is to compute the costly pair of keyboard & drive we can get from the the store, given the budget (b). The input is keyboards and d...

Kotlin safe casting

In multiple cases you might’ve came across the situation where you have to cast a global variable and check the instance beforehand. A most common case in Android environment is to check whether...