Skip to main content

All Questions

5 votes
4 answers
477 views

Count number of substrings in less time

Given an input string contains letters from 'a' to 'g' Count how many substrings are there in the input string such that frequency of any character inside the substring is not more than the number of ...
CodeCrusader's user avatar
13 votes
5 answers
2k views

solve n*m matrix processing in less time

I want to solve a problem in less time complexity. Here are the details: Given an n*m matrix, n rows and m columns. Initially, the matrix is empty filled with 0s. ...
CodeCrusader's user avatar
4 votes
2 answers
513 views

Leetcode: Steps to Make Array Non-decreasing

I was trying out leetcode's Steps to Make Array Non-decreasing As per the challenge's description: You are given a 0-indexed integer array nums. In one step, remove all elements nums[i] where nums[i ...
ccot's user avatar
  • 361
1 vote
3 answers
118 views

Find min sum for indices to match equation

I want to reduce time complexity of my code: I have an array of integers arr say [1, 2, 3, 6, 67] I have an equation : a*x+b*y=z, I can use the array values in this ...
Learner's user avatar
  • 227
9 votes
4 answers
2k views

Leetcode : First Missing Positive

I was trying out leetcode's first missing positive. As per the challenge's description: Given an unsorted integer array nums, return the smallest missing positive integer. You must implement an ...
ccot's user avatar
  • 361
2 votes
1 answer
140 views

Find character at given index in a sorted sub strings [closed]

For a given string say dbac the possible substrings are [d,db,dba,dbac,b,ba,bac,a,ac,c]. Sort them and concatenate to a string: ...
Learner's user avatar
  • 227
11 votes
6 answers
19k views

Enhanced Hashmap - Add a number to all keys/values

I had the below problem in a coding test and I got 28/30 tests passes and 2 failed due to a time-out. Problem You have created a programming language and now you have decided to add ...
Praveen's user avatar
  • 238
9 votes
3 answers
4k views

Find the smallest positive integer that is absent from a given array

I made the acquaintance of big-O a couple of weeks ago and am trying to get to grips with it, but although there's a lot of material out there about calculating time complexity, I can't seem to find ...
half of a glazier's user avatar
3 votes
1 answer
4k views

Ranking Score System

I have an assignment to solve this problem. There are a total of 12 test case files, 1 of which that I have failed due to exceeding limit on the script. Question Description Bob has somehow ...
Prashin Jeevaganth's user avatar
2 votes
2 answers
2k views

Mr. Muffin's ball-passing game

I have an assignment to solve this problem. There are a total of 18 test case files, 5 of which I have failed due to exceeding some time limit on the script and I am unable to verify if there are any ...
Prashin Jeevaganth's user avatar
5 votes
2 answers
3k views

Hackerrank "Almost Equal" solution

I've spent the best part of a day on this question. It is marked as Expert level. There are about fifteen submission test cases and my solution manages to satisfy the first four. However, from there ...
Mark Mc Adam's user avatar
2 votes
2 answers
393 views

TLE in JNEXT problem in SPOJ

Problem Statement: JNEXT DevG was challanged to find the just next greater number which can be formed using digits of a given number. Now DevG needs your help to find that just next greater number ...
Ladoo's user avatar
  • 69
4 votes
1 answer
139 views

INCARDS SPOJ challenge

Question- In short question says that you have N bus stops and K bus routes. Every bus routes is linked to two bus stops. Each route has some cost of travelling. It says one person visit any ...
Ladoo's user avatar
  • 69
4 votes
2 answers
22k views

Counting pairs that have a given difference in Java

You will be given an integer k and a list of integers. Count the number of distinct valid pair of integers (a,b) in the list for which a+k=b. For example, the array [1,1,1,2] has two different ...
Vaibs's user avatar
  • 155
3 votes
1 answer
598 views

Bovine Shuffle using a queue (USACO Dec 2017 Silver)

I am working on the "Bovine Shuffle" problem from the December 2017 USA Computing Olympiad, and have got it to work for every test case beside two. When I run these two cases on my own computer, they ...
CannotCode's user avatar

15 30 50 per page