Array and Strings

Asked atCapgemini
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
  1. 01Clarify the operation and input alphabet.
  2. 02Decide whether indexes, counts, or substrings are the core state.
  3. 03Choose direct scan, sliding window, frequency map, or sorting.
  4. 04State how updates preserve the target condition.
  5. 05Cover boundaries and encoding concerns.

Reference answer

Then expect these follow-ups

  • How do you prove each pointer moves at most n times?

    Tests: complexity analysis

  • When is sorting preferable to counting?

    Tests: follow-up reasoning

Hiring now

Capgemini is hiring right now

landed applies to roles like these for you, on each company’s own site, with answers written for the role.

Get 5x interviews10 free auto-applies. No card.
  • Cheffe / Chef de projet infrastructure

    Toulouse, Occitanie, France

  • Sales Developer Aéronautique

    Nantes

  • Ingénieure / Ingénieur DevOps Défense expérimenté

    Cesson-Sévigné, Brittany, France

Or practice this question first

Next question