All Questions
12 questions
1
vote
2
answers
124
views
I want reduce the time complexity for this ladder problem to find the minimum ladders required
I was trying to attempt below given challenge. I tried multiple ways to solve the problem but none of them were good enough to pass the time limit. Please advise if you have any idea to improve on ...
3
votes
0
answers
314
views
LeetCode: Stone Game C#
https://leetcode.com/problems/stone-game/
Alex and Lee play a game with piles of stones. There are an even
number of piles arranged in a row, and each pile has a positive
integer number of stones ...
2
votes
1
answer
191
views
LeetCode: Trapping Rain Water DP C#
Please review for performance and C# style.
I already solved this question in 1 way.
LeetCode: trapping rain water C#
I tried also the dynamic programming approch
https://leetcode.com/problems/...
3
votes
2
answers
351
views
LeetCode: Shortest Common Supersequence C#
https://leetcode.com/problems/shortest-common-supersequence/
Given two strings str1 and str2, return the shortest string that has
both str1 and str2 as subsequences. If multiple answers exist, ...
7
votes
2
answers
391
views
LeetCode: Burst Balloons C#
https://leetcode.com/problems/burst-balloons/
Given n balloons, indexed from 0 to n-1, ...
4
votes
2
answers
315
views
LeetCode: House Robber III C#
https://leetcode.com/problems/house-robber-iii/
Please review for performance
The thief has found himself a new place for his thievery again. There
is only one entrance to this area, called the "...
2
votes
3
answers
908
views
Leetcode #91 - Number of ways to decode a string
I'm working on problem 91 on Leetcode.com called Decode Ways and I've successfully managed to get a working recursive solution but it results in Time Limited ...
5
votes
1
answer
670
views
Longest Arithmetic Progression Algorithm
Problem Statement:
>
Given a sorted array, find the length of the longest arithmetic progression in it.
Examples:
numbers = new int[]{1, 3, 4, 5, 7, 8, 9}
The length is 5, and the sequence ...
2
votes
0
answers
3k
views
Hackerrank: Max Score
Problem statement
Consider an n-element sequence of integers, A = {a0, a0, ..., an-1}. We want to perform \$n\$ operations on \$A\$, where each operation is defined by the following sequence of ...
5
votes
1
answer
1k
views
Hackerrank: Lucky Number Eight (Dynamic Programming)
Problem statement
Given an n-digit positive integer, count and print the number of subsequences formed by concatenating the given number's digits that are divisible by 8. As the result can be large, ...
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 ...
4
votes
5
answers
1k
views
Pass Triangle challenge
In order to solve this challenge:
Challenge Description
By starting at the top of the triangle and moving to adjacent numbers on the row below, the maximum total from top to bottom is 27.
<...