Longest Common Subsequence Problem Statement

Given two Strings STR1 and STR2, determine the length of their longest common subsequence.

A subsequence is a sequence derived from another sequence by deleting some or no elements without changing the order of the remaining elements. A common subsequence is a subsequence that appears in both Strings.

Example:

Input:
T = 1
STR1 = "abcde", STR2 = "ace"
Output:
3
Explanation:

The longest common subsequence is "ace" with length 3.

Constraints:

  • 1 <= T <= 50
  • 1 <= |STR1| <= 10^2
  • 1 <= |STR2| <= 10^2
  • Where |STR1| and |STR2| denote the length of STR1 and STR2 respectively.
  • Time Limit: 1 sec
AnswerBot
4mo

Find the length of the longest common subsequence between two given strings.

  • Use dynamic programming to solve this problem efficiently.

  • Create a 2D array to store the lengths of common subsequences.

  • Iter...read more

Help your peers!
Select
Add answer anonymously...

Wipro Software Developer interview questions & answers

A Software Developer was asked 2mo agoQ. What languages have you used?
A Software Developer was asked 2mo agoQ. What are your qualities?
A Software Developer was asked 4mo agoQ. What is an operating system?

Popular interview questions of Software Developer

A Software Developer was asked 2mo agoQ1. What languages have you used?
A Software Developer was asked 2mo agoQ2. What are your qualities?
A Software Developer was asked 4mo agoQ3. What is an operating system?

Top HR questions asked in Wipro Software Developer

A Software Developer was asked 1mo agoQ1. Tell me about yourself.
A Software Developer was asked 1mo agoQ2. Tell me about your work experience.
A Software Developer was asked 4mo agoQ3. What is your expected salary?
Wipro Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits