Questions tagged [programming-challenge]
Programming challenges are off-site challenges meant to offer programmers educational experiences while testing their abilities.
3,022
questions
4
votes
0answers
27 views
Hackerrank's Queen's Attack II
https://www.hackerrank.com/challenges/queens-attack-2/problem
A queen is standing on an nxn chessboard. The chessboard's rows are numbered from 1 to n, going from bottom to top; its columns are ...
5
votes
2answers
214 views
Finding the number of moves a knight can perform while standing on a given square
This is a problem from CodeSignal which can be founded over here
Here is an image on what we have to do:
Code
...
8
votes
2answers
144 views
Making an array of spiral numbers
Context
I was solving a task on CodeSignal here
You can view the task on the link I provided above.
I have also put the task at the bottom of the post.
Code
...
8
votes
3answers
969 views
LeetCode 1108: Defanging an IP Address
I'm posting two solutions for LeetCode's "Defanging an IP Address". If you'd like to review, please do. Thank you!
Problem
Given a valid (IPv4) IP address, return a defanged version of that ...
-3
votes
0answers
42 views
My code is passing only few test cases [Trie data structure] [closed]
I have tested my code against all possible test cases. Ex: word present, not present in dictionary; given word is prefix of existing words, upper case, lower case. They passed. But not sure what I ...
9
votes
3answers
106 views
CSES standard solution for range query problem giving TLE
Problem statement is from CSES
This is a standard question where we are given a list of numbers and a number of queries. For each query, you have to give the sum of numbers in the given range.
My ...
4
votes
1answer
54 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 ...
3
votes
2answers
79 views
3-SAT Solver Python
I've written a 3-SAT solver based on this prompt:
Alice recently started to work for a hardware design company and as a part of her job, she needs to identify defects in fabricated integrated ...
12
votes
5answers
772 views
Array manipulation: add a value to each of the array elements between two given indices
This is a Hackerrank problem: https://www.hackerrank.com/challenges/crush/problem
You are given a list of size \$N\$, initialized with zeroes. You have
to perform \$M\$ operations on the list and ...
3
votes
3answers
383 views
LeetCode 535: Encode and Decode TinyURL
I'm posting a solution for LeetCode's "Encode and Decode TinyURL". If you'd like to review, please do. Thank you!
Problem
TinyURL is a URL shortening service where you enter a URL such as <...
5
votes
2answers
49 views
NEA Computing Task 2 Dice Game
I was recently set Task 2 as seen below and I realise someone answer the question on this site here but I wanted a fresh opinion
TASK 2:
Allows two players to enter their details, which are then ...
3
votes
0answers
50 views
Getting the minimum possible value from list consist of '0' and '1' by multiply no. of [0,1] and add the result after sliced in 'k' section [closed]
This code write to determine a way to place the N horses into the K stables, so that the total coefficient of unhappiness is minimized.
I use python to write a code and I want to reduce the running ...
5
votes
1answer
66 views
New Year Chaos (HackerRank problem) - find minimum swap count
The goal of the function is to find and print the minimum number of swaps (bribes) in what was initially a sorted array of ints - https://www.hackerrank.com/challenges/new-year-chaos/problem
I have ...
4
votes
1answer
51 views
Snake and ladder problem oops application
I am learning and trying to implement the best practice for snake and ladder game.
Rules of the game
The board will have 100 cells numbered from 1 to 100.
The game will have a six sided dice numbered ...
4
votes
1answer
55 views
LeetCode 1115: Print FooBar Alternately
I'm posting two solutions for LeetCode's "Print FooBar Alternately". If you'd like to review, please do. Thank you!
Problem
Suppose you are given the following code:
...