Skip to main content
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more. View results.

All Questions

Filter by
Sorted by
Tagged with
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 ...
wayne.blackmon's user avatar
4 votes
1 answer
182 views

LeetCode: Find And Replace in String C#

It took me a while to solve this question and there are corner cases i missed hence the 4 unit tests. please review for performance. and if you can treat this as a review for a 45 mins programming ...
Gilad's user avatar
  • 5,353
2 votes
1 answer
841 views

LeetCode: Greatest Common Divisor of Strings C#

https://leetcode.com/problems/greatest-common-divisor-of-strings/ For strings S and T, we say "T divides S" if and only if S = T + ... + T (T concatenated with itself 1 or more times) Return ...
Gilad's user avatar
  • 5,353
6 votes
3 answers
2k views

LeetCode: Group Anagrams C#

LeetCode: Group Anagrams C# Given an array of strings, group anagrams together. ...
Gilad's user avatar
  • 5,353
2 votes
3 answers
367 views

LeetCode:implement strstr C#

https://leetcode.com/problems/implement-strstr/ I implemented Rabin-Karp algorithm https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm please review for performance, also if you were in an ...
Gilad's user avatar
  • 5,353
3 votes
1 answer
124 views

CareerCup (Bloomberg): Check if string is valid based on brackets

The goal of this problem is to determine if a string with brackets is valid. Below is a summary of the question from careercup. Check if string s is valid based on brackets ...
RockLeeroy's user avatar
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. ...
AKdeBerg's user avatar
  • 195
2 votes
1 answer
498 views

LeetCode #28 - Boyer Moore string matching algorithm

The following code implements the Boyer Moore string matching algorithm. The algorithm is used to find a sub-string (called the pattern) in a string (called the text) and return the index of the ...
Andrew Au's user avatar
  • 537
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, ...
appa yip yip's user avatar
5 votes
2 answers
23k views

LINQ and string.Split do it yourself practice

Problem Statement: Implement a sentence scanning functionality to parse the sentence and return a string to concatenate each word with its number of occurrences, sorted by the number of ...
Jianmin Chen's user avatar
  • 2,456
4 votes
1 answer
614 views

Leetcode 125. Valid Palindrome

Problem statement Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example, "A man, a plan, a canal: Panama" is a ...
Jianmin Chen's user avatar
  • 2,456
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 ...
Jianmin Chen's user avatar
  • 2,456
19 votes
9 answers
2k views

Repeatedly eliminate a substring

I'm trying to pass a programming challenge where we are to replace all instances of a substring in a string until there are none left. So an input like ...
Seth Kitchen's user avatar
2 votes
2 answers
2k views

Leetcode 49: Group Anagrams - Hash function design talk

problem statement Given an array of strings, group anagrams together. For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], ...
Jianmin Chen's user avatar
  • 2,456
5 votes
1 answer
2k views

Hackerrank: Sherlock and anagram

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,456

15 30 50 per page