Longest Common Suffix
Updated
Problem statement
Given an array of strings words, return the longest string that is a suffix of every word. Return the empty string when there is no common suffix.
Function
longestCommonSuffix(words: String[]) → StringExamples
Example 1
words = ["running","jogging","walking"]return = "ing"Example 2
words = ["cat","dog"]return = ""Constraints
1 <= words.length <= 1000.0 <= words[i].length <= 1000.- The total number of characters is at most
100000.
More Chainalysis interview questions
- Course Schedule IIOA · Seen Nov 2022
- Meeting RoomsPHONE SCREEN · Seen Apr 2025
- Meeting Rooms IIPHONE SCREEN · Seen Apr 2025
- Block Transaction Count TrendsONSITE INTERVIEW · Seen Mar 2025
- Filter Team A LogsONSITE INTERVIEW · Seen Mar 2025
- Filter Team A Transfer LogsONSITE INTERVIEW · Seen Mar 2025
- High-Severity Counts by Search TypeONSITE INTERVIEW · Seen Mar 2025
- Team A High-Severity Transfer HashesONSITE INTERVIEW · Seen Mar 2025
Similar questions at other companies
- Count User Mentions in Chat MessagesRamp · OARamp interview questions
- Find Words That Can Be Formed by CharactersTabaPay · OA
- Word Frequency Counts in Alphabetical OrderAbridge · OAAbridge interview questions
- Count Multiples of Three with Two SevensHudson River Trading · OAHudson River Trading interview questions
- Customer Signer ScreeningState Farm · OA
- REST API: Highest International StudentsRippling · OARippling interview questions
- String-Pair Frequency SimilarityIBM · OAIBM interview questions
- Find Sliding-Window Pattern Start IndicesVisa · OAVisa interview questions
- Closest ColorTwo Sigma · OATwo Sigma interview questions
- Number-Character Bijective MappingAdobe · OAAdobe interview questions