Tap here to switch tabs
Problem
Submissions

Problem: Longest Uncommon Subsequence I

Longest Uncommon Subsequence I compares two strings and asks for the length of the longest subsequence that appears in one string but not the other. Return negative one if none exists.

Statement

Given two strings a and b, return the length of the longest uncommon subsequence between them. If no uncommon subsequence exists, return −1-1.

An uncommon subsequence between two strings is defined as a string that is a subsequence of one string but not a subsequence of the other.

Note: A subsequence of a string is a new string generated from the original string by deleting zero or more characters without changing the relative order of the remaining characters.

Constraints:

  • 1≤1 \leq a.length, b.length ≤100\leq 100

  • a and b consist of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Longest Uncommon Subsequence I

Longest Uncommon Subsequence I compares two strings and asks for the length of the longest subsequence that appears in one string but not the other. Return negative one if none exists.

Statement

Given two strings a and b, return the length of the longest uncommon subsequence between them. If no uncommon subsequence exists, return −1-1.

An uncommon subsequence between two strings is defined as a string that is a subsequence of one string but not a subsequence of the other.

Note: A subsequence of a string is a new string generated from the original string by deleting zero or more characters without changing the relative order of the remaining characters.

Constraints:

  • 1≤1 \leq a.length, b.length ≤100\leq 100

  • a and b consist of lowercase English letters.