PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Citadel

Solve four algorithmic problems

Last updated: May 5, 2026

Quick Overview

This multi-part question evaluates algorithmic problem-solving skills across combinatorics and subsequence counting, array partitioning with prefix-sum or dynamic programming optimization, constrained subset selection and feasibility reasoning, and reachable-state/MEX analysis under bounded operations, alongside complexity analysis and efficient algorithm design. It is commonly asked in Coding & Algorithms interviews because it probes reasoning about constructive sequence operations, optimization under constraints, and achievable-state characterization while balancing time and space complexity, and it tests both conceptual understanding and practical application.

  • Medium
  • Citadel
  • Coding & Algorithms
  • Software Engineer

Solve four algorithmic problems

Company: Citadel

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Take-home Project

Answer the following independent algorithmic questions: 1) Count extendable prefixes for '10' subsequences: Given a binary string s and an integer k, you may append '0' or '1' to the end any number of times. A non-empty prefix p of s is valid if there exists some sequence of appends to p such that the total number of subsequences equal to "10" in the resulting string is exactly k. Here a "10" subsequence is a pair of indices (i, j) with i < j, s[i] = '1', and s[j] = '0'. Return the number of valid non-empty prefixes of s. 2) Maximize alternating four-segment sum: Given an integer array a[1..n], choose three cut indices 1 ≤ i1 ≤ i2 ≤ i3 ≤ n+1 to form four contiguous (possibly empty) segments s1 = a[1..i1-1], s2 = a[i1..i2-1], s3 = a[i2..i3-1], s4 = a[i3..n]. Define value = sum(s 1) - sum(s 2) + sum(s 3) - sum(s 4). Cuts may coincide and may be at the array ends. Compute the maximum possible value. You may assume n ≤ 3·10^3. 3) Select the largest agreeable developer team: There are n developers with skill i for 1 ≤ i ≤ n. Given arrays lowerSkill[1..n] and higherSkill[1..n], choose the largest subset T such that for every i ∈ T, at most lowerSkill[i] members of T have skill less than i and at most higherSkill[i] members of T have skill greater than i. Return |T|. 4) Find all achievable MEX values with bounded increments: You have n memory blocks memoryBlocks[0..n-1]. You may repeatedly choose an index x and increase memoryBlocks[x] by 1 only while memoryBlocks[x] < n - 1. After any number of operations, the MEX of the array is the smallest non-negative integer absent from it. Return all distinct MEX values that are achievable, in ascending order.

Quick Answer: This multi-part question evaluates algorithmic problem-solving skills across combinatorics and subsequence counting, array partitioning with prefix-sum or dynamic programming optimization, constrained subset selection and feasibility reasoning, and reachable-state/MEX analysis under bounded operations, alongside complexity analysis and efficient algorithm design. It is commonly asked in Coding & Algorithms interviews because it probes reasoning about constructive sequence operations, optimization under constraints, and achievable-state characterization while balancing time and space complexity, and it tests both conceptual understanding and practical application.

Related Interview Questions

  • Implement a single-producer multi-consumer ring buffer - Citadel (medium)
  • Sort a Nearly Sorted Array - Citadel (hard)
  • Compute BBO and NBBO from order data - Citadel (medium)
  • Design dynamic weighted random sampling with updates - Citadel (medium)
  • Compute maximum later-earlier difference - Citadel (medium)
Citadel logo
Citadel
Sep 6, 2025, 12:00 AM
Software Engineer
Take-home Project
Coding & Algorithms
10
0

Answer the following independent algorithmic questions:

  1. Count extendable prefixes for '10' subsequences: Given a binary string s and an integer k, you may append '0' or '1' to the end any number of times. A non-empty prefix p of s is valid if there exists some sequence of appends to p such that the total number of subsequences equal to "10" in the resulting string is exactly k. Here a "10" subsequence is a pair of indices (i, j) with i < j, s[i] = '1', and s[j] = '0'. Return the number of valid non-empty prefixes of s.
  2. Maximize alternating four-segment sum: Given an integer array a[1..n], choose three cut indices 1 ≤ i1 ≤ i2 ≤ i3 ≤ n+1 to form four contiguous (possibly empty) segments s1 = a[1..i1-1], s2 = a[i1..i2-1], s3 = a[i2..i3-1], s4 = a[i3..n]. Define value = sum(s
    • sum(s
    • sum(s
    • sum(s 4). Cuts may coincide and may be at the array ends. Compute the maximum possible value. You may assume n ≤ 3·10^3.
  3. Select the largest agreeable developer team: There are n developers with skill i for 1 ≤ i ≤ n. Given arrays lowerSkill[1..n] and higherSkill[1..n], choose the largest subset T such that for every i ∈ T, at most lowerSkill[i] members of T have skill less than i and at most higherSkill[i] members of T have skill greater than i. Return |T|.
  4. Find all achievable MEX values with bounded increments: You have n memory blocks memoryBlocks[0..n-1]. You may repeatedly choose an index x and increase memoryBlocks[x] by 1 only while memoryBlocks[x] < n - 1. After any number of operations, the MEX of the array is the smallest non-negative integer absent from it. Return all distinct MEX values that are achievable, in ascending order.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Citadel•More Software Engineer•Citadel Software Engineer•Citadel Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.