Questions tagged [programming-challenge]

Programming challenges are off-site challenges meant to offer programmers educational experiences while testing their abilities.

Filter by
Sorted by
Tagged with
0
votes
0answers
27 views

InterviewBit Problem: Stringoholics

I am trying to solve https://www.interviewbit.com/problems/stringoholics/ InterviewBit problem. But I got Time Limit Exceed Error. I followed the below approach: With respect to a single string, the ...
4
votes
1answer
46 views

Calculate probability that knight does not attempt to leave chessboard after at most k random moves (LeetCode #688)

I'm learning competitive programming and came across this question on LeetCode : 688. Knight Probability in Chessboard On an n x n chessboard, a knight starts at the cell (row, column) and attempts ...
1
vote
2answers
77 views

How can i reduce the time complexity further for this solution?

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 ...
4
votes
1answer
110 views

Contacts programming challenge

I successfully solved a problem on Hackerrank called Contacts, but I'm curious if my code in C++ looks good to C++ developers. If not, how it should be improved. Below is the short description of the ...
2
votes
2answers
67 views

OOP refactoring technique

I'm teaching myself Object Oriented Programming in JavaScript and I'm looking over this small P5 code of CodingTrain's No.78, which deals with flying particles in the canvas, as a material. The full ...
4
votes
1answer
80 views

Comparing Poker hands in Rust

I found this interesting challenge in Exercism. This is my approach to comparing poker hands in Rust. I've strived for code clarity. I wish I had figured out how to only implement Ord or PartialOrd, ...
2
votes
1answer
59 views

Molybdenum2019 challenge efficient implementation

I'm working on a solution that is correct but inefficient. https://app.codility.com/programmers/task/leader_slice_inc/ This is my code : ...
2
votes
1answer
47 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 ...
1
vote
2answers
89 views

Counting numbers that have an even number of digits

I solved this problem: given an array/vector of numbers, return how many of them contain an even number of digits. Constraints: ...
0
votes
0answers
73 views

LeetCode: Delete and Earn C#

https://leetcode.com/problems/delete-and-earn/ Given an array nums of integers, you can perform operations on the array. In each operation, you pick any nums[i] and delete it to earn nums[i] points. ...
0
votes
5answers
81 views

Determine whether a magazine contains the words needed for a ransom note

This is a website Question on Hackrrank called Hash Tables: Ransom Note: Given the words in the magazine and the words in the ransom note, print "Yes" if we can replicate the ransom note ...
2
votes
1answer
66 views

Find sub-list index with the closest to a given number sum

The task that I have to perform is to take an array of a specific length, and figure out which sub-list has the closest sum to another given number. Then, I need to print the index of that sub-array. ...
1
vote
1answer
77 views

Returning maximum number of consecutive 1s in list of binary numbers

This is what I implemented in Rust to get the maximum number of consecutive 1s in list of binary numbers. ...
1
vote
0answers
38 views

LeetCode: range sum query mutable c#

https://leetcode.com/problems/range-sum-query-mutable/ I am trying to solve this question using dynamic programming. I guess the guys in leetcode want to limit us to use segment tree or one of the ...
2
votes
2answers
52 views

Kattis 'Driver's Dilemma'

The full problem description can be found here, a slightly trimmed version below: A car driver is travelling on an isolated road (no gas stations, houses, or cell phone coverage). The driver glances ...

15 30 50 per page
1
2 3 4 5
209