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
8
votes
2answers
56 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 ...
1
vote
0answers
48 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
21 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
49 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 ...
4
votes
2answers
172 views

Find out whether number is of Power of Two

The task is taken from leetcode Given an integer, write a function to determine if it is a power of two. Example 1: Input: 1 Output: true Explanation: 20 = 1 Example 2: ...
-3
votes
0answers
29 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 ...
6
votes
8answers
988 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 ...
3
votes
1answer
77 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: ...
4
votes
1answer
58 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.) ...
4
votes
1answer
65 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
38 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) ...
2
votes
0answers
1k views

Shortest way to form a string out of a subsequence of a string

The task is taken from LeetCode (subscription required) - From any string, we can form a subsequence of that string by deleting some number of characters (possibly no deletions). Given two strings ...
1
vote
0answers
27 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) ...
1
vote
0answers
723 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 ...
6
votes
3answers
12k views

Cadbury problem solution in Python

Problem Statement In a School, Chocolate bars have to be distributed to children waiting in a queue. Each Chocolate bar is rectangular in shape. Consider its side lengths are integer values. The ...
1
vote
0answers
46 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....
7
votes
1answer
206 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 ...
9
votes
2answers
187 views

Tail implementation using a dynamic queue library

As per K & R exercise 5-13 Write the program tail, which prints the last n lines of its input. By default, n is 10, say, but it can be changed by an optional argument, so that ...
1
vote
2answers
42 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 ...
1
vote
1answer
35 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 ...
6
votes
2answers
778 views

Finding the position in a triangle for the given challenge

The LAMBCHOP doomsday device takes up much of the interior of Commander Lambda's space station, and as a result the prison blocks have an unusual layout. They are stacked in a triangular shape, and ...
2
votes
1answer
49 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 ...
9
votes
6answers
538 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 ...
2
votes
1answer
74 views

LeetCode 146: LRU Cache II

I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Problem Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following ...
2
votes
0answers
57 views

LeetCode 200: Number of Islands

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 grid map of '1's (land) and '0's (water), count the number of islands. ...
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 ...
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: ...
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 ...
1
vote
1answer
40 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 ...
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"? ...
14
votes
3answers
7k views

LeetCode: LRU cache implementation C#

I have implemented an LRU cache, the question is taken from: leetcode: 146. LRU Cache Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following ...
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
2answers
75 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 ...
1
vote
1answer
41 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 ...
1
vote
1answer
42 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 ...
5
votes
1answer
3k views

HackerRank: Fraudulent activity notification

I wanted to get some constructive feedback on my solution to the Fraudulent Activity Notification problem from HackerRank: HackerLand National Bank has a simple policy for warning clients about ...
7
votes
2answers
3k views

Down to Zero II

Problem : https://www.hackerrank.com/challenges/down-to-zero-ii You are given queries. Each query consists of a single number N. You can perform 2 operations on N in each move. If N=a*b (a!=1,b!=...
1
vote
2answers
2k views

Python Implementation: Summer of 69

SUMMER OF '69: Return the sum of the numbers in the array, except ignore sections of numbers starting with a 6 and extending to the next 9 (every 6 will be followed by at least one 9). Return 0 ...
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 ...
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 ...
10
votes
2answers
640 views

Array duplicate removal for duplicates exceeding `N`-number

I recently encountered a front-end interview coding challenge question that required one to create a function which returned an array that excluded numbers that occurred more than ...
14
votes
4answers
5k views

Google Foobar Challenge: Lucky Triples

Note: Since my time has passed for this challenge, I do not remember exactly the stipulations but will attempt to recapitulate them to the best of my knowledge. Essentially, the challenge was 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. ...
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? ...
4
votes
1answer
118 views

Leetcode three sum in Javascript

I was doing 3sum question 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 sum ...
7
votes
4answers
6k views

Project Euler problems 1 and 2 in python

What do you think about my code? I am a beginner and just started doing some algorithmic exercises to sharpen up my python skills. Here is code for problem #1: ...

1
2 3 4 5
60