All Questions
38 questions
4
votes
3
answers
855
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.
<...
0
votes
2
answers
1k
views
Sherlock and Anagrams in Javascript
I am trying to solve a Hackerrank problem Sherlock and Anagrams. I think my code is valid but somehow times out for some of the test cases. Any tips on how to improve its performance? Critique ...
6
votes
3
answers
2k
views
LeetCode: Group Anagrams C#
LeetCode: Group Anagrams C#
Given an array of strings, group anagrams together.
...
3
votes
1
answer
810
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 ...
8
votes
4
answers
4k
views
Reversing a string - two approaches
Test Case:
Input- "I'm hungry!"
Output- "!yrgnuh m'I"
Approach 1: In this approach, I used a empty string and bind it with the input string reversely.
...
2
votes
1
answer
229
views
String reversing x times
Inspired by CodeWars
We have a string s
Let's say you start with this: "String"
The first thing you do is reverse it: "gnirtS"
Then you will take ...
6
votes
2
answers
583
views
Search and Replace (FreeCodeCamp intermediate algorithm scripting)
I completed this challenge Search and Replace and passed the tests:
Perform a search and replace on the sentence using the arguments provided and return the new sentence.
First argument is the ...
13
votes
3
answers
4k
views
Codewars: Reduce strings to one character
I am trying to solve a puzzle in a performant way. This is the puzzle.
Simply explained: you have a String and you must reduce it to one character with the given rules. This is the solution to the ...
3
votes
1
answer
680
views
Check if two strings are permutations of each other
Description:
Given two strings check if those two are permutation of each other. Its expected that input string can contain ASCII characters.
Code:
...
3
votes
3
answers
2k
views
Interleaving two strings
The challenge:
From: URI Online Judge
Implement a program Combiner that takes two Strings as parameters and combines them, alternating letters, starting with the first letter of the first String, ...
6
votes
2
answers
5k
views
Partitioning input strings by even and odd indexes
I have been trying to learn javascript for a year now, and have just embarked on HackerRank's 30 days of code. After a couple of days I finally solved this problem. Here is the task (if you click the ...
3
votes
1
answer
974
views
Extract index of first unique element in large array in Swift
I'm using the following code to return the first index of a unique character in a large String. It works fine until I get to large strings, where it times out.
Is ...
3
votes
0
answers
791
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 ...
3
votes
1
answer
2k
views
Ashton and String Hackerrank
Online coding challenge Hacker Rank.
I tried to solve it using the naive appraoch first but its failing on some of the inputs and rest its getting timed out. How to get started in problem like these ...
2
votes
1
answer
4k
views
Build String Hackerrank
Online challenge on Hacker Rank.
Please follow the description from the above link.
...