Skip to main content

All Questions

Filter by
Sorted by
Tagged with
3 votes
1 answer
266 views

Longest Palindromic Substring | Python Code Giving TLE

Problem Statement Given a string s , return the longest palindromic substring in s. Constraints ...
Rohit Singh's user avatar
1 vote
2 answers
140 views

finding whether two string are anagrams of each other [closed]

...
King _ AJ's user avatar
0 votes
1 answer
373 views

Generate unique string permutations recursively

🧩 Objective Write a recursive method for generating all permutations of an input string. Return them as a set. See: Recursive String Permutations - Interview Cake 🔎 Questions 1: How does the ...
AdamHurwitz's user avatar
9 votes
1 answer
2k views

LeetCode on Longest Palindromic Substring in Python

This is a programming question from LeetCode: Given a string s, return the longest palindromic substring in s. Example 1: Input: s = "babad" Output: "bab" Note: "aba" is ...
user avatar
1 vote
2 answers
110 views

A function to scan user input as string

I know that multiple functions are already available. However, I thought of writing my own because I wanted to learn the logic (and also because I thought there wasn't enough confusion :P). Please ...
kesarling's user avatar
  • 352
1 vote
0 answers
128 views

How do I optimize memoization in order to find longest palindromic substring?

I want to find the longest palindromic substring using dynamic programming in Python3. The strings can be as large as this string. I have seen other questions on this problem that successfully solve ...
Aviral Srivastava's user avatar
2 votes
1 answer
78 views

Length of the longest common sub sequence bottom up

Could I get some feedback on this code? I included a test case as well. This code computes the longest common sub sequence given paired data, it was not part of any challenge I just did it to learn ...
justanothertechdude's user avatar
5 votes
1 answer
152 views

Identify fraudulent bank transactions

Task: Return true if a transaction is allowed and return false if transaction is prohibited. Details: 1. String is represented as an "array" that can contain up to three elements. We need to ...
user194076's user avatar
3 votes
2 answers
1k views

Counting the number of ways to decode a string

I am working on problem where I need to decode a string: A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... ...
user5447339's user avatar
2 votes
0 answers
1k views

minimum window subsequence leetcode dynamic programming solution

Given strings S and T, find the minimum (contiguous) substring W of ...
noman pouigt's user avatar
6 votes
2 answers
2k views

Length of longest palindrome subsequence

I had an interview, where I was asked to solve to this question: Given an string str, find the maximum length of palindrome subsequence. Example: >if str = 'abcda': maximum_length = 3 'aca' How ...
Harsha's user avatar
  • 1,291
3 votes
0 answers
787 views

Hackerrank: Sherlock and anagram (optimal time complexity)

Problem statement Given a string \$S\$, find the number of "unordered anagrammatic pairs" of substrings. Input Format First line contains \$T\$, the number of testcases. Each testcase ...
Jianmin Chen's user avatar
  • 2,396
3 votes
1 answer
111 views

Given two words, transform the first one into the second [closed]

As the title says, the problem I had to do sounded something like this: We are given two words, S1 and S2. We must transform S1 into S2, using the following operations: insert: insert a character in ...
Emy's user avatar
  • 31
2 votes
1 answer
574 views

Longest common substring using dynamic programming

I've written a short python script that attempts to solve the problem of finding the longest common substring using the dynamic programming technique. It is meant to be generalised so I could plug in ...
Pavlin's user avatar
  • 163
1 vote
1 answer
2k views

Levenshtein distance with edit sequence and alignment in Java

I have this program that computes a Levenshtein distance of the two input strings, their edit sequence, and the alignment: LevenshteinEditDistance.java: ...
coderodde's user avatar
  • 29.8k
3 votes
2 answers
881 views

Longest Common Subsequence and Longest Subsequence Palindrome

The following code computes: The longest common subsequence between two strings, where a subsequence of a sequence does not have to consist of contiguous elements of the sequence. The longest ...
Millie Smith's user avatar