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
4
votes
3answers
33 views

Printing pyramids in C (CS50)

I'm taking the CS50 course, and we're asked to create a program which takes an input (the total height of the pyramid) and outputs a pyramid of that height. i.e Here’s how the program might work if ...
2
votes
2answers
28 views

Revised: Counting subnumbers divisible by a given prime

I asked this question, and due to the guidance, I improved my code as follows: ...
0
votes
1answer
70 views

Advent of Code 2020 - Day 2: validating passwords

Previous: Advent of Code 2020 - Day 1: finding 2 or 3 numbers that add up to 2020 Next: Advent of Code 2020 - Day 3: tobogganing down a slope Problem statement I decided to take a shot at Advent of ...
0
votes
0answers
7 views

Advent of Code 2020 - Day 3: tobogganing down a slope

Previous: Advent of Code 2020 - Day 2: validating passwords Problem statement I decided to take a shot at Advent of Code 2020 to exercise my Rust knowledge. Here's the task for Day 3: Day 3: ...
6
votes
7answers
11k views

Hacker rank 30 days of code Maximum Sum of Hourglass

I came up with this code as a solution to a contest question. The original question can be viewed here for attribution sake: Hackerrank 2d array problem Sample input is like this: ...
0
votes
1answer
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 ...
1
vote
1answer
64 views

Project Euler 8 - Largest product in a series [closed]

The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. 73167176531330624919225119674426574742355349194934 ...
2
votes
1answer
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 ...
0
votes
1answer
59 views

Advent of Code 2020 - Day 1: finding 2 or 3 numbers that add up to 2020

Next: Advent of Code 2020 - Day 2: validating passwords Problem statement I decided to take a shot at Advent of Code 2020 to exercise my Rust knowledge. Here's the task for Day 1: Day 1: Report ...
4
votes
1answer
60 views

Minimum number of copies of an application a company needs to purchase

Some applications from vendors are allowed to be installed on multiple computers per user with specific restrictions. In our scenario, each copy of the application (ID 374) allows the user to install ...
2
votes
3answers
278 views

Find nearest k points from the central point

The task: Given a list of points, a central point, and an integer k, find the nearest k points from the central point. For example, given the list of points [(0, 0), (5, 4), (3, 1)], the ...
-3
votes
0answers
25 views

Programming a Coinflip on C [closed]

I have to program the following Simulation in C! My exercise is: What’s the minimum number of times you have to flip a coin before you can have three consecutive flips that result in the same outcome (...
11
votes
3answers
3k views

HackerRank Implement Queue using two stacks Solution

Challenge Problem Statement - Implement a Queue using two Stacks I implemented dequeue() in \$O(1)\$ at the cost of enqueue() ...
1
vote
1answer
99 views

Coin Flip Streaks script

I am attempting to complete the coin flip streaks problem from automate the boring stuff with python. My code works fine but my only concern is the phrasing of the task. Does the question want us to ...
1
vote
2answers
44 views

Advent Of Code 2020, day 1, find desired sum and multiply the addends

you can find the challenge here for more details, but the subject says it all; Check a provided list of entries for 2 numbers which sum to 2020, return the product of those addends. I waited until the ...
3
votes
2answers
77 views

Debounce function that limits the rate a callback is triggered. Which implementation is better, and why?

The Debounce technique allow us to “group” multiple sequential calls in a single one - The debounce() function forces a function to wait a certain amount of time before running again. I wrote both <...
3
votes
1answer
27 views

Another Sliding Window - find each `k-size` window the maximum num. from an integer array/list

I've searched this site and find many similar questions, but not exactly the same as the one I'll post. This attempts to solve Leetcode 239: You are given an array of integers ...
2
votes
1answer
35 views

PowerShell - calculate occurences of Friday the 13th between (including) two given years with builtin and without builtin

It's me again, talented programming beginner fast-learner, so I have overcomed yet another self-imposed programming challenge, I have developped two algorithms to calculate occurrences of Friday the ...
5
votes
3answers
383 views

Mars Rover technical Challenge in OOP

I am trying to practice OOP and TDD concepts, I have written this code for Mars rover challenge from marsrovertechchallenge . Can you please review my code from my GitHub repository? Or you can ...
9
votes
1answer
3k views

Mars Rover Kata using TDD and SOLID

I am doing MarsRoverKata exercise just to train my coding skills and I came up with the following solution. A squad of robotic rovers are to be landed by NASA on a plateau on Mars. This ...
4
votes
1answer
91 views

Hackerrank: Breaking the records

I'm learning Clojure and am a rank n00b at it, trying to learn from books and online tutorials (but I'm sometimes concerned that I am picking up bad habits or at least not all the good habits). For ...
15
votes
6answers
4k views

Prime numbers that are also a prime number when reversed

This is a challenge on Codewars I took years ago. Task is to find all prime numbers that are also a prime number when reversed, i.e. 13 -> 31 is such a number. This is still the answer with the ...
1
vote
0answers
4k views

Equal number of chocolates [closed]

Problem: Christy is interning at HackerRank. One day she has to distribute some chocolates to her colleagues. She is biased towards her friends and plans to give them more than the others. One of the ...
3
votes
3answers
2k views

Google Foobar level 3

Over the past few weeks, I've been doing the Google Foobar challenges and I've been progressing quite well. I'm currently 1/3 of the way through the third level. However, there were plenty of times ...
4
votes
2answers
71 views

sum of multiples by 3 or 5 using ranges

This program calculates the sum of all integers in the range \$[1, 1000)\$ which are multiples of either 3 or 5 or both. Inspired by x86-64 Assembly - Sum of multiples of 3 or 5 the other day, and ...
24
votes
4answers
2k views

x86-64 Assembly - Sum of multiples of 3 or 5

I'm trying to learn some basic x86 assembly and so I've begun solving Project Euler problems. I was hoping for some critique of my code that, hopefully, includes either the efficiency of the ...
3
votes
1answer
101 views

Longest Absolute File Path in Leetcode

I solved the Longest Absolute File Path challenge from Leetcode. The question is Suppose we abstract our file system by a string in the following manner: The string ...
6
votes
3answers
6k views

Finding the next palindrome of a number string

Here is the problem: A positive integer is called a palindrome if its representation in the decimal system is the same when read from left to right and from right to left. For a given positive ...
1
vote
1answer
90 views

Follow-up: How can we optimizing Java BigInteger operations?

This is the follow up question of How can we optimizing Java BigInteger operations? Problem Reduce the number to 1 in a minimal number of steps, following the rules: ...
4
votes
1answer
149 views

Project Euler # 53 Combinatoric selections in Python

There are exactly ten ways of selecting three from five, 12345: 123, 124, 125, 134, 135, 145, 234, 235, 245, and 345 In combinatorics, we use the notation, 5C3=10. In general, nCr = n! / r! (n−r)!, ...
2
votes
1answer
58 views

how can I optimize this code for a powerline?

I made this code for a past test, I only got 30/100 points obtainable, because it went out of time,how can I make it more efficient? ...
7
votes
2answers
3k views

Code Vita: Form the maximum possible time in the HH:MM:SS format using any six of nine given single digits

Problem Description The objective is to form the maximum possible time in the HH:MM:SS format using any six of nine given single digits (not necessarily distinct) Given a set of nine ...
1
vote
1answer
128 views

Advent of Code 2020 Day 9 in Python

This is a solution for part 1 & 2 of Advent of Code 2020 Day 9. Given the example input sample.txt: ...
1
vote
0answers
47 views

PowerShell - Calculating date difference between two given dates in days without builtin and with builtin

The title says it all, I have written two scripts to calculate dates to test my abilities in programming, one from scratch, without [DateTime], New-TimeSpan and even [math]::Ceiling, and it's really ...
8
votes
2answers
981 views

Leetcode longest substring without repeating characters

Link here I'm currently learning c++ coming from a python background, so I'll include a solution in python and in c++ for the following problem statement and based on very helpful answers obtained on ...
4
votes
0answers
52 views

C++ - Longest Common Subsequence

Link to the Problem Here is my code to compute the length of the longest common subsequence of two integer arrays arr[] and brr[]...
2
votes
0answers
34 views

PowerShell - Find Least Common Multiple of a series of numbers

I am a Windows power user, a system tweaker, my idol is Leanardo da Vinci, and now I want to be a hacker. I am extremely new to programming, but I really am a fast learner if I am interested in the ...
1
vote
0answers
34 views

PowerShell - Convert English words describing numbers to their values in Arabic numeral

I am extremely new to programming, and I am a really fast learner if I am interested, I have only started using PowerShell in less than a month, to improve my programming skill, this is a script I ...
2
votes
1answer
63 views

Extract values from English numerals, e.g. “nine million and one”

Though many have done it the other way around, I have not seen such code in many places. And, to be honest, I don't know why this cluster of if-statements, ...
1
vote
1answer
34 views

Perform various actions on a list

I am solving the following HackerRank problem: Consider a list (list = []). You can perform the following commands: insert i e: Insert integer e at position i. <...
0
votes
1answer
146 views

Counting subnumbers divisible by a given prime

Assume we are given a number and a prime p. The goal is to count all subnumbers of number ...
12
votes
4answers
612 views

Finding the largest of a series of numbers being XORed

I'm working on solving a problem involving finding the largest of a series of numbers being XORed. This is the actual problem: Xorq has invented an encryption algorithm which uses bitwise XOR ...
1
vote
0answers
24 views

(from codeabbey) This code is supposed to add or multiply a bunch of numbers and at the end divide by a certain number and outpout the decimals [closed]

For example if the numbers are: 5 + 3 * 7 + 10 * 2 * 3 + 1 % 11 then it would multiply and add all the numbers giving 397 and divide by 11 giving 36.09 so therefore it must output 1. My code works in ...
3
votes
2answers
2k views

Given time intervals, find the minimum number of conference rooms required

The task is taken from LeetCode Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference rooms required....
1
vote
4answers
115 views

Leetcode minimum path sum

Link here I'll include a solution in Python and C++ and you can review one. I'm mostly interested in reviewing the C++ code which is a thing I recently started learning; those who don't know C++ can ...
3
votes
0answers
77 views

LeetCode: Stone Game C#

https://leetcode.com/problems/stone-game/ Alex and Lee play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of stones ...
4
votes
1answer
67 views

Implementing an autocomplete system

Question: Implement an autocomplete system. That is, given a query string s and a set of all possible query strings, return all strings in the set that have s as a prefix. For example, given the query ...
2
votes
1answer
55 views

Google Foobar Level 1 - Minion Task Schedule

I recently just stumbled upon a post regarding Google Foobar Level 2 and decided to try it out myself but starting from Level 1. The description and code are shown below. Write a function called <...
0
votes
2answers
148 views

Finding a common prefix

The problem I am trying to solve: Given a string, split the string into two substrings at every possible point. The rightmost substring is a suffix. The beginning of the string is the prefix. ...
1
vote
2answers
114 views

Google foobar level 2 challenge

I am a beginner in Python-3. I was solving a level 2 challenge in Google Foobar. Given an initial amount of items (LAMBs) I have to distribute it among individuals, who are ranked according to ...

1
2 3 4 5
62