Skip to main content

All Questions

1 vote
1 answer
233 views

Find a secret word given an array of triplets? (codewars problem)

The rules for the puzzle are: Each triplet has the rules of how the letters are ordered in the secret word (each letter is followed by the next letter inside the triplet array). all the letters of ...
Jonas's user avatar
  • 131
2 votes
3 answers
415 views

Leetcode First Unique Character in a String code optimisation

I was working on First Unique Character in a String Question Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1. Example 1: ...
D_S_X's user avatar
  • 189
1 vote
2 answers
343 views

Leetcode 377. Combination Sum IV Javascript Memoization attempt

Problem Statement ...
Prashin Jeevaganth's user avatar
1 vote
1 answer
180 views

Maximum Profit in Job Scheduling - Performance Issue

I implemented the Maximum Profit in Job Scheduling algorithm in JavaScript, but I'm having performance issue. The problem: We have n jobs, where every job is scheduled to be done from startTime[i] to ...
myTest532 myTest532's user avatar
1 vote
1 answer
524 views

Cheapest flights within k stops algorithm in JavaScript

The problem: There are n cities connected by some number of flights. You are given an array flights where flights[i] = [fromi, toi, pricei] indicates that there is ...
myTest532 myTest532's user avatar
2 votes
1 answer
227 views

Leetcode 3 sum code optimisation

I was working on 3sum problem on leetcode Question Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the ...
D_S_X's user avatar
  • 189
3 votes
0 answers
2k views

HackerRank's Challenging Palindromes solution times out for certain tests

I am trying to solve the Challenging Palindromes problem from HackerRank. The code that I have got so far fails only for large inputs due to timeout, every other test it passes successfully. The ...
Atul Vani's user avatar
2 votes
1 answer
926 views

Codewars: Prime Streaming (PG-13)

I'm timing out on Codewars' Prime Streaming kata. Below is my code: ...
Tobi Alafin's user avatar
  • 1,792
3 votes
1 answer
2k views

Maze path finder using Depth-First Search algorithm

I'm trying to resolve this kata from CodeWars. Kata exercise You are at position [0, 0] in maze NxN and you can only move in one of the four cardinal directions (i.e. North, East, South, West). ...
Ender Look's user avatar
5 votes
2 answers
2k views

Hackerrank.com - Sherlock and Anagrams

Summary: Given a string find the number of anagramic pairs of substrings of it. e.g 'abba' pairs are [a,a],[b,b],[ab,ba],[abb,bba] so we have 4 pairs. I'm wondering if anyone can help me improve my ...
Thiago Caramelo's user avatar
2 votes
3 answers
2k views

Climbing the Leaderboard: HackerranK, Terminated due to timeout

I have implemented my solution and I thought it was pretty efficient and passes most of the cases but seems like it fails some of the test cases when the input size is very large. I basically push ...
Ugur Yilmaz's user avatar
6 votes
2 answers
3k views

Minimum swaps algorithm terminated due to timeout

I have been trying to solve this question. Given an unordered array consisting of consecutive integers [1, 2, 3, ���, n], find the minimum number of two-element swaps to sort the array. I was able ...
Ugur Yilmaz's user avatar
2 votes
2 answers
130 views

Forming all multiples of 3 using the given digits

I'm working on this kata from Codewars. The task is: Given a certain number, how many multiples of three could you obtain with its digits? Supose that you have the number 362. The numbers that can be ...
j_d's user avatar
  • 171
1 vote
4 answers
723 views

Find value that occurs in odd number of elements

I am trying to solve the following exercise using Javascript: A non-empty array A consisting of N integers is given. The array contains an odd number of elements, and each element of the array can be ...
Anirban Bera's user avatar
3 votes
1 answer
72 views

Terminated due to timeout Mapping phone numbers

I have a code based on the following problem "Mapping phone numbers to names", the problem is that when they are going to process large data(+100.000) the program ends by timeout. my code and problem ...
Herman Andres Figueroa's user avatar

15 30 50 per page