Lexicographically Smallest String After Operations With Constraint at ServiceNow

Medium62.9% acceptance

This problem has 87.5% frequency at ServiceNow.

Problem Description

You are given a string `s` and an integer `k`. Define a function `distance(s1, s2)` between two strings `s1` and `s2` of the same length `n` as: * The**sum** of the **minimum distance** between `s1[i]` and `s2[i]` when the characters from `'a'` to `'z'` are placed in a **cyclic** order, for all...

Read full problem and hints

Topics


More ServiceNow Questions

View all ServiceNow questions