Skip to main content

All Questions

6 votes
8 answers
1k views

Reversing vowels in a string

Given a string s, reverse only all the vowels in the string and return it. The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and upper ...
user avatar
2 votes
1 answer
134 views

Count how many numbers in a range have exactly three divisors

The challenge Given array a of n numbers, I need to count how many positive numbers less than each aᵢ have exactly 3 divisors. Constraints 1 <= aᵢ <= 2.5 * 10¹³ In other words, the minimum ...
Muhammad Usman's user avatar
6 votes
1 answer
329 views

Codeforces: D2. Counting Is Fun (Hard Version)

The code works okay for the following problem. Problem An array 𝑏 of 𝑚 non-negative integers is said to be good if all the elements of 𝑏 can be made equal to 0 using the following operation some (...
user24714692's user avatar
4 votes
2 answers
497 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
  • 341
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
  • 341
2 votes
1 answer
62 views

SEDE query to count questions, views and unanswered for a set of tags

This query selects the number of SO questions, the number of views and the number of unanswered questions for each tag (the list of the tags is the user input). It works fine when it works, but it ...
Yulia V's user avatar
  • 635
3 votes
2 answers
303 views

Trailing Digits

https://www.acmicpc.net/problem/23204 I've solved a programming challenge where you need to count the occurrences of a specific digit at the end of the product of multiples of a given number within a ...
qleoz12's user avatar
  • 141
4 votes
1 answer
525 views

calculate the number of ways to pick two different indices

I'm working on a codesignal practice problem You are given an array of integers a and an integer k. Your task is to calculate the number of ways to pick two different indices i < j, such that a[i] ...
Josh's user avatar
  • 41
6 votes
1 answer
127 views

One or more planets to line up with the earth a certain amount of times

I have attempted the below question, however my solution is too slow (i.e. It does not fit the 2 second time constrain for java). How can the solution be optimised? While at IOI 2020 in Singapore, ...
Zareef Akoodie's user avatar
1 vote
1 answer
56 views

Find all combinations of two companies grouped by the projects they are tendering for

I am working on the task to get all possible combinations (pairs) of ID's (companies) which participated in one bid and create a new data frame with ID_1, ID_2, matching parameter (tender ID). I have ...
Vasya_Ch's user avatar
9 votes
3 answers
2k views

Repeatedly remove a substring quickly

I'm trying to solve the USACO problem Censoring (Bronze), which was the first problem for the 2015 February contest. My solution works for some test cases, but then times out for test cases 7-15. I ...
user avatar
2 votes
1 answer
111 views

USACO Arithmetic Progression

The problem statement: An arithmetic progression is a sequence of the form a, a+b, a+2b, ..., a+nb where n=0, 1, 2, 3, ... . For this problem, a is a non-negative integer and b is a positive integer. ...
Michael Granger's user avatar
-2 votes
2 answers
141 views

Lower-Bound algorithm getting Time Limit Exceeded

...
Shakhawat Hossain SHIHAB's user avatar
2 votes
2 answers
95 views

For two sequences N and M, display counts of elements n from N below each m from M up to the first n above m

A school's task: There are two sequences n_tab and m_tab. For every element m in m_tab ...
Szyszka947's user avatar
2 votes
1 answer
117 views

Reviews a daily fantasy slate to check for duplicate lineups

My code below is used as a back testing tool to review a past Daily Fantasy Sports slate. This code works perfectly but when the contest size (total entrants) gets up to the 30,000 range it takes ...
safo2238's user avatar

15 30 50 per page
1
2 3 4 5
9