All Questions
Tagged with programming-challenge strings
217 questions
6
votes
1
answer
565
views
Substring = Permutation of a given pattern
I am working on a problem on LeetCode.
Considering only lowercase characters from 'a' to 'z', I have written some Java code to check if a permutation of a given pattern is a substring of a given ...
7
votes
5
answers
2k
views
Solving an easy LeetCode "Merge Strings Alternately"
I am a C++ dev trying to solve problems in C to practice it, specifically the LeetCode Merge Strings Alternately problem:
You are given two strings word1 and word2. Merge the strings by adding ...
8
votes
2
answers
859
views
Basic C++ implementation of linux wc command
I am working on the Build Your Own wc Tool coding challenge in C++. I have a working implementation that seems to match the output of the wc command for different ...
1
vote
1
answer
77
views
String represents a road. One character travels on the road obeying the stops - Code challenge (advent.js day 5)
This is my code to solve the 5th Adventjs challenge. In that link you can read the instructions.
How can I improve it? It's a bit messy... and I'm repeating some part of the code.
All must be in just ...
4
votes
3
answers
860
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.
<...
2
votes
1
answer
191
views
An evolutionary algorithm written in Java to crack an XOR cipher
Alright. So TryHackme is a website that tries to teach hacking with hands on labs. They have a room called JVM Reverse Engineering where the user gets to reverse engineer Java apps, and in particular ...
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 ...
1
vote
2
answers
164
views
Find longest palindrome in a string (LeetCode problem 5)
The code below is my solution to the following problem (problem #5 on LeetCode):
Given a string s, return the longest palindromic substring in s.
I wonder whether my use of iterators is an overkill. ...
2
votes
3
answers
1k
views
Find the 'n' most frequent words in a text, aka word frequency
I'm doing freeCodeCamp's Coding Interview Prep to improve my JavaScript skills. This challenge is called "Word Frequency", and is based on the Rosetta Code's entry of the same name.
The ...
2
votes
3
answers
223
views
Phrase to acronym in C from exercism.io
I am learning C and doing challenges like those found on exercism.io and the various data structure & algorithm sites.
I have a sense that while this works and it makes sense to me that it can be ...
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 ...
2
votes
2
answers
987
views
InterviewBit Problem: Stringoholics
I am trying to solve this InterviewBit problem.
Problem Statement:
You are given an array A consisting of strings made up of the letters
‘a’ and ‘b’ only. Each string goes through a number of ...
6
votes
1
answer
654
views
LeetCode 1638: Count Substrings That Differ by One Character
I'm posting a solution for LeetCode's "Count Substrings That Differ by One Character". If you'd like to review, please do. Thank you!
Problem
Given two strings s and t, find the number of ...
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 ...
5
votes
4
answers
2k
views
C#: Repeated String
From HackerRank "Repeated String" challenge:
Lilah has a string, \$s\$, of lowercase English letters that she repeated
infinitely many times.
Given an integer, \$n\$, find and print the ...