Tracxn F2F interview

Posted
21 Jul 2025
298 reads

Summary

This post details a specific coding question encountered during a Tracxn interview.

How it went

This post provides the full problem statement, input, output, and explanation for a coding question asked during a Tracxn interview round.

Questions asked (1)

  1. 01

    Find Valid Substrings Based on Character Frequency Constraints

    Data Structures & Algorithms

    You are given:

    • A string s of lowercase English letters.
    • An integer k, representing the required length of each substring.
    • A Map<Character, Integer> charCount, where each entry (ch, freq) specifies that character ch must appear at least freq times in a valid substring.

    Your task:
    Return a list of all unique substrings of length k from the string s such that:

    • Each character in charCount appears in the substring at least the number of times specified.
    • Substrings are considered unique, so repeated substrings should only appear once in the result.

    without using substring and built in functions of string

    Input:
    s = "abacad"
    k = 3
    charCount = { 'a': 2, 'b': 1 }

    Output:
    ["aba"]

    Explanation:
    - "aba" has two 'a's and one 'b'
    - Other substrings of length 3: "bac", "aca", "cad" don't meet the character frequency criteria.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Tracxn recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!