Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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

-5
votes
0answers
9 views

How to fetch value from a field on website [on hold]

I need to fetch a value from a field from a website which itself needs a username and password for logging in. The website is internetaccount.orange.mu. The value is for 'remaining volume bank'. I ...
-3
votes
0answers
7 views

in play framework, inserting multiple array of data with diffrent properties in database [on hold]

i want to insert marks of student, meaning that each student have his own marks, and have his id, now i want to insert list of students, each with unique identifications, means in list of student, ...
10
votes
1answer
46 views

CodeVita challenge: forming the latest valid datetime in a year using some given digits

After answering someone's Code Review question, I decided to tackle a sequel: Given an input consisting of 12 non-decreasing single digits separated by commas, form the latest valid date time in a ...
-2
votes
1answer
84 views

Project Euler Problem 1 with Python 3 ideal solution

I have been playing around in hacker rank with Python these days, and now pulling my hair out on this question to solve the Euler's problem in the least time required. If we list all the natural ...
2
votes
3answers
60 views

Climbing the Leaderboard: HackerranK, Terminated due to timeout

I have implemented my solution and I thought it was pretty efficient and passes most of the cases but seems like it fails some of the test cases when the input size is very large. I basically push ...
8
votes
2answers
80 views

Python 3 two-sum performance

I just submitted a Python solution to the 'Two Sum' problem on LeetCode. The Problem Given an array of integers, return indices of the two numbers such that they add up to a specific target. ...
1
vote
1answer
35 views

Project Euler 41 Generating Pandigital Numbers [closed]

Project Euler question 41: We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once. For example, 2143 is a 4-digit pandigital and is also prime. ...
5
votes
2answers
55 views

LinkedList class implementation in Python

I was solving this problem for implementing LinkedList and ListNode classes, and Insert and <...
2
votes
2answers
88 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 ...
2
votes
2answers
65 views

Forming all multiples of 3 using the given digits

I'm working on this kata from Codewars. The task is: Given a certain number, how many multiples of three could you obtain with its digits? Supose that you have the number 362. The numbers that ...
5
votes
2answers
75 views

Pig Latin Anslatortray

I've created a program that translates any word into the form of igpay atinlay or pig Latin! I got the project idea from here and you can read the rules here. My program outputs the same translation ...
0
votes
2answers
43 views

Lattice path from Project Euler with Python solution

I was trying to solve this problem called lattice path from Project Euler: Count the number of unique paths to travel from the top left to the bottom right of a lattice of squares. How many such ...
5
votes
3answers
1k views

Are strings anagram

This is a question from the book "Cracking the Coding Interview". Write a method to decide if two strings are anagrams or not I think interviewer will not be convinced with this solution because ...
2
votes
1answer
28 views

Search and Replace (FreeCodeCamp intermediate algorithm scripting)

I completed the challenge and passed the tests: Perform a search and replace on the sentence using the arguments provided and return the new sentence. First argument is the sentence to perform ...
2
votes
1answer
46 views

Code Vita : Chakravyuha

Problem Statement A Chakravyuha is a wheel-like formation. Pictorially it is depicted as below A Chakravyuha has a very well-defined co-ordinate system. Each point on the co-...
4
votes
2answers
125 views

Remove duplicate characters in a string

This is a question from the book "Cracking the Coding Interview". Design an algorithm and write code to remove the duplicate characters in a string without using any additional buffer NOTE: One ...
5
votes
4answers
122 views

In-place reverse of C-style string

This is a question from the book "Cracking the Coding Interview". Write code to reverse a C-Style String (C-String means that “abcd” is represented as five characters, including the null ...
4
votes
1answer
120 views

Generate Christmas Tree

Problem Statement: The Christmas tree is comprised of the following Parts Stand Each Part is further comprised of Branches. Branches are comprised of Leaves. How the tree appears as a ...
1
vote
1answer
35 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 ...
5
votes
8answers
2k views

Check if a string has all unique characters

This is a question from the book "Cracking the Coding Interview". Implement an algorithm to determine if a string has all unique characters What if you can not use additional data structures? I ...
4
votes
1answer
42 views

Sorting software version list using Python 2.7 (no modules)

I am participating in a challenge and one of the challenges was to write a script to sort a list of software versions (ex: 1.0, 1.3.2, 12, 1.3.0). Here is the my solution: ...
3
votes
1answer
70 views

Solving maze problem with backtracking solution using stack

I solved the maze backtracking question using a stack however could not find any other solution like that anywhere (to validate my solution is actually a valid one). The problem statement is as ...
4
votes
2answers
57 views

Use Python to determine the repeating pattern in a string (no leftovers)

As a part of a challenge, I was asked to write a function to determine if there was repetition in a string (if no repetition, output is 1), and if a substring is repeated throughout the string (for ...
6
votes
1answer
96 views

Finding intersting path in a graph

There is a question in a contest but it doesn't have any answer. I solve it but I get time limit for most of test case. Is it possible to improve my code or give a better approach? Question There is ...
7
votes
2answers
230 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 ...
3
votes
3answers
167 views

Find k-distinct partitions which contain at least two perfect squares

Problem Statement: A k-distinct-partition of a number \$n\$ is a set of \$k\$ distinct positive integers that add up to \$n\$. For example, the 3-distinct partitions of 10 are \$1+2+7\$ \$...
10
votes
3answers
591 views

Master Locksmith

Description Master Locksmith has just finished the work of his life: a combination lock so big and complex that no one will ever open it without knowing the right combination. He's done testing ...
4
votes
2answers
81 views

Demonstration of Scale Balancing

Have the function ScaleBalancing(int vector, int vector) read vectors which will contain two elements, the first being the two positive integer weights on a balance scale (left and right sides) ...
9
votes
8answers
1k views

Find the repeated elements in a list

You are given an array of n+2 elements. All elements of the array are in range 1 to n. All elements occur once except two numbers, which occur twice. Your task is to find the two repeating numbers. ...
3
votes
1answer
66 views

Efficient Road Network

Intro I've decided to learn haskell, because I've always enjoyed the functional aspect of Python and want to explore other languages that use this concept. I'm still stumbling in the dark most of the ...
6
votes
1answer
75 views

Multithreaded testing for counting rooms from a floor plan solution

This is version 3 of Efficiently counting rooms from a floorplan. Version 2 is here Efficiently counting rooms from a floorplan (version 2) It also has a comprehensive test facility that is the ...
7
votes
3answers
140 views

Counting ways to choose vertices that form a right triangle

Croatian Open Competition in Informatics, contest 3, December 8, 2007 4. DEJAVU \$N\$ points are placed in the coordinate plane. Write a program that calculates how many ways we can choose ...
4
votes
1answer
66 views

Counting out game with std::list

I recently tried to solve the Josephus Problem on Sphere Online to help answer this question but am getting TLE for any solution I come up with. The exact parameters of the problem are: This is ...
1
vote
0answers
28 views

Quora upvotes trends Hackerrank challenge

The following code is my solution to an old problem I found today. Input Format Line 1: Two integers, N (1 ≤ N ≤ 106) and window size K (1 ≤ K ≤ N) Line 2: N positive integers of upvote ...
7
votes
1answer
102 views

Swiftly counting rooms in a floor plan

Inspired by recent questions about counting the rooms in a floor plan (1, 2, 3), here is my attempt to solve the problem with a Swift program. The problem (from “Counting Rooms” on CSES) is: You ...
10
votes
5answers
2k views

Efficiently counting rooms from a floorplan (version 2)

This is version 2 of Efficiently counting rooms from a floorplan. I had accidentally pasted in the wrong version of the code. Update Final version (version 3) of the code with updated test harness ...
6
votes
1answer
271 views

Efficiently counting rooms from a floorplan

Note this was the wrong version of the code. The updated version is here: Efficiently counting rooms from a floorplan (version 2) My apologies! Update Final version 3 with test harness here: ...
7
votes
1answer
210 views

Calculating the number of rooms in a 2D house

I stumbled upon this problem on cses.fi (a problem set for the Finnish Olympiad in Informatics. This problem is in finnish so I'll translate it). I'll describe the problem, present the code and think ...
2
votes
1answer
37 views

Hash Tables: Ransom Note - Hacker Rank in Javascript [closed]

I'm preparing for an interview doing the preparation questions on Hacker Rank and I want to become better at this. Is it possible to get some feedback on this? How can I improve my code? How did you ...
6
votes
2answers
90 views

Find words that can be typed using only one row on a keyboard

on leetcode.com, there is a question with the following description: Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like ...
1
vote
3answers
88 views

Euler Project 14 Longest Collatz Sequence [closed]

I have been working through the euler project and I have created the following code for Problem 14, which asks which starting number, under 1 million, produces the longest Collatz Sequence chain. It ...
5
votes
0answers
160 views

Codewars: N-dimensional Von Neumann Neighborhood in a matrix

Task: For creating this challenge on Codewars I need a very performant function that calculates Von Neumann Neighborhood in a N-dimensional array. This function will be called about 2000 times The ...
4
votes
1answer
79 views

Countdown Timer in Python

I am a beginner in Python and I am yet to move on from the basics to things like OOP.I wrote all of this code (Python 3) in an hour or so for a simple countdown timer.Although some parts of it are ...
2
votes
1answer
119 views

Project Euler: Find 10.001st prime

I have just started learning C# and decided to do some problems from Project Euler. I wrote a code to find 10 001st prime and I thought it would be cool optimize it to make it as fast as possible. How ...
8
votes
1answer
99 views

Google FooBar “Prepare The Bunnies Escape”

I'm currently working through the google FooBar challenge, and I'm on the third level, in which I have to find the distance between the top left and bottom right points on a grid. The grid is filled ...
1
vote
1answer
50 views

Binary search in Scala

Another exercise in Scala in which the goal is to find the target position as fast as possible. The initial input provides the grid size and the initial position. Each turn, this code provide a new ...
6
votes
2answers
191 views

The Ducci Sequence

I wrote the following Rust code to solve this task on /r/DailyProgrammer. Given an n-tuple of numbers as input, the Ducci Sequence is formed by taking the absolute difference of the difference ...
3
votes
2answers
87 views

Demonstration of ChessBoard Traveling (CoderByte)

Problem Have the function ChessboardTraveling(str) read str which will be a string consisting of the location of a space ...
8
votes
4answers
1k views

Project Euler #15: counting paths through a 20 × 20 grid

I've recently solved Project Euler's 15th problem stating: Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom ...
1
vote
1answer
69 views

Project Euler #211: Divisor Square Sum

I started doing hackerrank problems only recently and here's my attempt to solve this problem. Basically, you're given two integers N and ...