PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Roku

Compute longest common subsequence length

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of dynamic programming and sequence processing, measuring competence in reasoning about optimal substructure, overlapping subproblems, and algorithmic complexity.

  • medium
  • Roku
  • Coding & Algorithms
  • Software Engineer

Compute longest common subsequence length

Company: Roku

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

## Problem You are given two strings `s` and `t`. A **subsequence** of a string is obtained by deleting zero or more characters without changing the order of the remaining characters. Return the **length** of the **longest common subsequence (LCS)** between `s` and `t`. ## Input - Two strings `s`, `t` ## Output - An integer: the length of the LCS of `s` and `t` ## Constraints (typical interview bounds) - `0 <= len(s), len(t) <= 1000` - Strings contain lowercase/uppercase letters (assume ASCII letters) ## Examples - `s = "abcde"`, `t = "ace"` → output `3` (LCS could be `"ace"`) - `s = "abc"`, `t = "def"` → output `0`

Quick Answer: This question evaluates understanding of dynamic programming and sequence processing, measuring competence in reasoning about optimal substructure, overlapping subproblems, and algorithmic complexity.

Related Interview Questions

  • Implement ad filtering and concurrent cache - Roku (medium)
Roku logo
Roku
Jan 8, 2026, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
2
0
Loading...

Problem

You are given two strings s and t. A subsequence of a string is obtained by deleting zero or more characters without changing the order of the remaining characters.

Return the length of the longest common subsequence (LCS) between s and t.

Input

  • Two strings s , t

Output

  • An integer: the length of the LCS of s and t

Constraints (typical interview bounds)

  • 0 <= len(s), len(t) <= 1000
  • Strings contain lowercase/uppercase letters (assume ASCII letters)

Examples

  • s = "abcde" , t = "ace" → output 3 (LCS could be "ace" )
  • s = "abc" , t = "def" → output 0

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Roku•More Software Engineer•Roku Software Engineer•Roku 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.