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
2
votes
0answers
21 views

Smashing two heaviest stones until at most one stone is left - counting number of stone comparisions

Based on this question: Heaviest Stone algorithm time complexity Problem: We have a collection of stones, each stone has a positive integer weight. Each turn, we choose the two heaviest stones and ...
-4
votes
0answers
29 views

HackerRank Apples(Python) [closed]

There are M Women sitting on the chair in a row. Every woman has a number assigned to it. Person A is distributing the apples to those women with following conditions. Each woman has at least one ...
5
votes
2answers
30 views

Advent of Code 2019: Day 6 (with Trees)

I've been going through some 2019 AoC challenges and decided to solve Day 6 in Haskell with the help of Data.Tree. In summary, the puzzle provides a list of orbits (...
7
votes
2answers
549 views

This python code converts integers to strings and strings to ints without the inbuilt functions “int()” and “str()”

It is my solution from a challange from edabit.com named "Drunken Python". Thats the task: You need to create two functions to substitute str() and int(). A function called int_to_str() that ...
1
vote
0answers
52 views

Minimum number of steps to reduce a number k to m [closed]

I was solving a question on HackerEarth - link here There are three integers k,m,n. You have to convert the number k to m by performing the given operations: Multiply k by n Decrease k by 2. ...
1
vote
0answers
24 views

LeetCode 1263: Minimum Moves to Move a Box to Their Target Location ||

I'm posting a follow-up code on this question, which seems to be a basic version of Sokoban. If you'd like to review, please do so. Thank you for your time! Problem Storekeeper is a game in which the ...
2
votes
1answer
52 views

LeetCode 1263: Minimum Moves to Move a Box to Their Target Location

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem Storekeeper is a game in which the player pushes boxes around in a warehouse trying ...
-3
votes
0answers
30 views

seek the highest value [closed]

I've been having trouble with a programming exercise where your goal is to find the highest value of assigned experience, example: input ...
8
votes
2answers
57 views

Line wrapping text utility using fixed-size arrays

As an exercise, I've made a text processing utility that wraps arbitrarily long lines of text, but only using fixed-size arrays and other basic C features. I have mostly programmed in Python, C++ and ...
5
votes
1answer
62 views

LeetCode 928: Minimize Malware Spread II

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem (This problem is the same as Minimize Malware Spread, with the differences bolded.) ...
6
votes
7answers
1k views

Verifying if a string can be created with the letters of another string

This is basically based on the following question on stackoverflow which was based on a codewars assignment that can be found here Problem statement Complete the function ...
1
vote
0answers
28 views

LeetCode 839: Similar String Groups III

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem Two strings X and Y are similar if we can swap two letters (in different positions) ...
4
votes
1answer
66 views

LeetCode 839: Similar String Groups II

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem Two strings X and Y are similar if we can swap two letters (in different positions) ...
1
vote
1answer
39 views

LeetCode 839: Similar String Groups

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem Two strings X and Y are similar if we can swap two letters (in different positions) ...
3
votes
1answer
79 views

Project Euler 67 | Maximum sum path II reading from file

I tried to solve the Problem Euler 67 with golang, because I started to study Go recently. This is my solution: ...
1
vote
0answers
49 views

LeetCode 483: Smallest Good Base

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem For an integer n, we call k>=2 a good base of n, if all digits of n base k are 1....
1
vote
1answer
36 views

LeetCode 124: Binary Tree Maximum Path Sum 2

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem Given a non-empty binary tree, find the maximum path sum. For this problem, a path ...
1
vote
2answers
43 views

LeetCode 124: Binary Tree Maximum Path Sum

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem Given a non-empty binary tree, find the maximum path sum. For this problem, a path ...
2
votes
1answer
50 views

LeetCode 1453: Maximum Number of Darts Inside of a Circular Dartboard

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem You have a very large square wall and a circular dartboard placed on the wall. You ...
1
vote
1answer
41 views

LeetCode 906: Super Palindromes

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem Let's say a positive integer is a superpalindrome if it is a palindrome, and it is ...
1
vote
0answers
759 views

Better performance in solution for the Dole Out Cadbury challenge

Dole Out Cadbury Problem Description You are a teacher in reputed school. During Celebration Day you were assigned a task to distribute Cadbury such that maximum children get the chocolate. You have ...
1
vote
2answers
76 views

LeetCode 913: Cat and Mouse

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem A game on an undirected graph is played by two players, Mouse and Cat, who ...
9
votes
6answers
541 views

Sum of integers in an interval

Here is my solution to a series of problems in JS fundamentals. I've made it passing but I know this could be more efficient. I'm not looking for anyone to rewrite the code, but just asking what ...
1
vote
1answer
42 views

LeetCode 952: Largest Component Size by Common Factor

I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem Given a non-empty array of unique positive integers A, consider the ...
7
votes
1answer
211 views

XOR Encryption, Decryption, and Cracking in Python

I have recently been working through a number of the Cryptopals Cryptography Challenges to try and improve my knowledge and understanding of both cryptography and Python. As five of the first six ...
3
votes
1answer
33 views

Box and Cox process

The code obtains Box and Cox transformed data. The original data is a Pandas DataFrame and the process uses this DataFrame. I am trying to speed up the following code. If you can elaborate in faster ...
0
votes
2answers
77 views

LeetCode 126: Word Ladder II

I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem Given two words (begin and <...
1
vote
1answer
43 views

LeetCode 149: Max Points on a Line

I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem Given n points on a 2D plane, ...
2
votes
1answer
47 views

LeetCode 1463: Cherry Pickup II

I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem Given a rows x cols matrix grid ...
2
votes
0answers
22 views

Benchmarking multiple implementations of a Code Kata: queue for the self-checkout tills at the supermarket

I was reading this question: Why is my function timing out when run with a larger data set? And although I couldn't quite grasp the OP's implementation and so didn't feel like answering. I did some ...
5
votes
0answers
69 views

LeetCode 37: Sudoku Solver

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku ...
4
votes
1answer
68 views

LeetCode 924: Minimize Malware Spread

I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem In a network of nodes, each node i is directly connected to another ...
3
votes
0answers
58 views

Count unique subsequences

I came across this question in a coding competition (Java-restricted) and I got a time-length-exceeded. I am unable to provide a link as the contest is closed now. Can I know how can I optimise this? ...
3
votes
1answer
155 views

Analysis of multiple game scores

I am trying to create a list based on some data, but the code I am using is very slow when I run it on large data. So I suspect I am not using all of the Python power for this task. Is there a more ...
2
votes
2answers
91 views

LeetCode 273: Integer to English Words

I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem Convert a non-negative integer to its English words representation. ...
2
votes
1answer
48 views

LeetCode 639: Decode Ways II

I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem A message containing letters from A-Z is being encoded to numbers ...
3
votes
1answer
77 views

Find lowest consecutive value

I have created a program where I first set the size of the array and how many times I will look for consecutive values, then I fill in the array and finally I insert the consecutive values, it should ...
2
votes
2answers
66 views

LeetCode 862: Shortest Subarray with Sum at Least K

I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem Return the length of the shortest, non-empty, contiguous subarray ...
3
votes
1answer
68 views

CodeWars Deodorant Evaporator

How can I make the solution to this https://www.codewars.com/kata/5506b230a11c0aeab3000c1f/train/fsharp more "functional"? ...
4
votes
1answer
55 views

LeetCode 894: All Possible Full Binary Trees

I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem A full binary tree is a binary tree where each node has exactly 0 ...
1
vote
1answer
43 views

LeetCode 410: Split Array Largest Sum

I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem Given an array which consists of non-negative integers and an ...
5
votes
0answers
47 views

LeetCode 284: Peeking Iterator

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem Given an Iterator class interface with methods: ...
1
vote
0answers
43 views

LeetCode 212: Word Search II

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time! Problem Given a 2D board and a list of words from the dictionary, find all words in the ...
0
votes
1answer
35 views

LeetCode 652: Find Duplicate Subtrees

I'm posting my code for a LeetCode problem copied here. If you have time and would like to review, please do so. Thank you! Problem Given a binary tree, return all duplicate subtrees. For each kind ...
4
votes
2answers
103 views

LeetCode 1032: Stream of Characters

I'm posting my code for a LeetCode problem copied here. If you have time and would like to review, please do so. Thank you! Problem Implement the StreamChecker ...
3
votes
3answers
85 views

Project Euler 50: Consecutive prime sum

I just finished solving Project Euler's 50th problem, but it's awfully slow. I'd like to hear your thoughts on my code's efficiency and practices. Problem Statement The prime 41, can be written as the ...
-2
votes
1answer
85 views

Programming challenge - report fraudulent banking activity times out

How can I optimise this code there is time out error Program Challenge: HackerLand National Bank has a simple policy for warning clients about possible fraudulent account activity. If the amount ...
10
votes
2answers
367 views

C++, sort integers using knowledge of entire vector

I am solving the "Sort" problem on Kattis. Mirko is a great code breaker. He knows any cipher in the world can be broken by frequency analysis. He has completely the wrong idea what ...
3
votes
1answer
56 views

LeetCode 753: Cracking the Safe

I'm posting my code for a LeetCode problem copied here. If you have time and would like to review, please do so. Thank you! Problem There is a box protected by a password. The password is a sequence ...

1
2 3 4 5
60