Skip to main content

All Questions

Filter by
Sorted by
Tagged with
4 votes
3 answers
859 views

Codewars: Multiplying Polynomials

I'm trying to solve the following Kata from Codewars in Python. My code produces the desired result for all the tests, yet it is not optimal, so it takes too much time to accomplish the big tests. <...
GuntherOnFire's user avatar
2 votes
1 answer
193 views

follow-up - Checking Nested Bracket Levels in Strings Programming Challenge

A follow-up to this question, this post improves on test case issues. To restate problem parameters, a given string S is considered closed if it: Has a matching ...
T145's user avatar
  • 3,149
10 votes
4 answers
3k views

First non-repeating Character, with a single loop in Python

I recently tried to solve the first non-repeating character problem. Please tell me if my solution is valid. I'm aiming for O(n) with a single loop. My thinking is, it would be easy to tell you what ...
zing's user avatar
  • 203
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
2 votes
2 answers
363 views

Exercism: determine if a word or phrase is an isogram

The task: Determine if a word or phrase is an isogram. An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter, however spaces and hyphens are allowed ...
Konstantin Kostanzhoglo's user avatar
3 votes
1 answer
2k views

Find and return the earliest occurring word from a string which contains the most repeating letters

I'd like feedback on my solution to the outlined programming challenge (medium level). I've tried it fast in any way I know how to, but, what might be a more efficient and/or pythonic solution? [...
Dave's user avatar
  • 753
3 votes
1 answer
3k views

Run length encoding of an input string (Coderbyte 'Run Length' challenge)

I'd like feedback on my solution to the outlined (medium level) programming challenge. What might be a more efficient or Pythonic solution? The challenge as outlined by Coderbyte: [Run Length] (...
Dave's user avatar
  • 753
2 votes
0 answers
308 views

Split a string into valid words

I am trying to solve this LeetCode question: Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentence where each word is ...
nz_21's user avatar
  • 1,051
5 votes
2 answers
320 views

Leetcode longest substring with no duplicates

...
neet's user avatar
  • 91
3 votes
1 answer
812 views

Rosalind - Finding a Shared Motif using the Ukkonen algorithm

Here is my attempt to implement the Ukkonen algorithm for the Finding a Shared Motif problem on rosalind.info. The code works; it produces a correct answer. It does so in 11 seconds, but I am hoping ...
Andrew Au's user avatar
  • 537
2 votes
1 answer
1k views

CodingBat: without_end

Link To Question Given a string, return a version without the first and last char, so "Hello" yields "ell". The string length will be at least 2. without_end('Hello') → 'ell' ...
Ben A's user avatar
  • 10.7k
4 votes
2 answers
772 views

Letter case permutation

The question can be found here https://leetcode.com/problems/letter-case-permutation Given a string S, we can transform every letter individually to be lowercase or uppercase to create another ...
user avatar
1 vote
1 answer
5k views

String Rotation

I have solved a previous year question of 2018 codevita (link) in Python. Problem Description: Rotate a given String in the specified direction by specified magnitude. After each rotation make a ...
itsvinayak's user avatar
3 votes
1 answer
3k views

Zig-zag function - coded solution

Here is my coded solution to the LeetCode zig-zag problem - The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this (you ...
MrJoe's user avatar
  • 2,143
6 votes
1 answer
409 views

Palindrome insertion challenge

Here is my solution to the following Daily Coding Problem challenge: Given a string, find the palindrome that can be made by inserting the fewest number of characters as possible anywhere in the word....
MrJoe's user avatar
  • 2,143

15 30 50 per page