Year

2022 archive

A year-sized slice of the daily archive, ordered newest first.

62 entries

62 entries from 2022.

20.11.2022

hard

Basic Calculator

fun calculate(s: String): Int {

Recursive evaluation using substring splitting for parentheses groups String parsing and manipulation Basic arithmetic evaluation

19.11.2022

hard

Erect The Fence

fun outerTrees(trees: Array): Array {

IntArray MutableList sort andrew's monotonic chain vector algebra for ccw check convex hull monotone chain

8.11.2022

easy

Make The String Great

The simplest solution is just to simulate all the process, as input string is just 100 symbols.

char array (toCharArray) string manipulation nested loops for pairwise comparison iterative process to resolve conflicts checking adjacent/non-adjacent characters for equality and difference string processing

1.11.2022

medium

Where Will The Ball Fall

This is a geometry problem, but seeing the pattern might help. We can spot that each row is an action sequence: -1 -1 -1 shifts balls left, and 1 1 1 shifts balls to the right. Corners can be formed only with -1 1 sequence.

indToBall iterative_update tracking_ball_positions identifying_shift_rules grid_manipulation