**2.108 programming-challenge questions.**

I took a challenge on CodeEval. Although the code seems to work for the examples taken from the site, I feel it is not really pretty and must be more complicated than it should be.
Description:
...

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 ...

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 ...

Project Euler Problem 23
A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of \$28\$ would be \$1 + 2 ...

This is a follow-up question for HackerRank - Array Manipulation
Problem
You are given a list (1-indexed) of size \$n\$, initialized with zeroes.
You have to perform \$m\$ operations on the ...

This is my implementation for this hacker rank problem. (And a follow-up.)
Problem
You are given a list(1-indexed) of size n, initialized with zeroes.
You have to perform m operations on the ...

The challenge
The captcha requires you to review a sequence of digits (your puzzle input) and find the sum of all digits that match the next digit in the list. The list is circular, so the digit ...

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.
...

The question is similar to my previous question but is quite different, hence I won't call it a follow up. I have made changes like fixing bugs and replacing bubble sort from review of previous ...

I was solving this problem for implementing LinkedList and ListNode classes, and Insert and <...

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 ...

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.
...

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 ...

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 ...

Given a collection of intervals, merge all overlapping intervals.
For example,
Given [1,3],[2,6],[8,10],[15,18],
return [1,6],[8,10],[15,18].
GitHub
...

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 ...

I just solved the Hash Tables: Ransom Note problem on Hackerrank using both Java-8 and Java-7. Given m words in a magazine and the n words in the ransom note, print ...

I have been trying to solve this simple problem on SPOJ for quite some time now, but I keep on getting TLE (Time limit exceeded) for some reason.
Since the problem is in Portuguese, a brief ...

I wrote an algorithm to solve this challenge but would love some feedback on its efficiency and, if you were an interviewer, what your opinion would be on my solution. I believe my time complexity is \...

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: https://www.dreamincode.net/forums/topic/78802-martyr2s-mega-project-...

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 ...

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 ...

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 ...

Problem Statement
You will be given a list of 32 bits unsigned integers. You are required to output the list of the unsigned integers you get by flipping bits in its binary representation (i.e. ...

Find all pairs in an array that sum to a given number without using HashMap.
Duplicate pairs are not allowed. Input array cannot be modified.
input: ...

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 ...

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 ...

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\$
\$...

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-...

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 ...

I attempted this sample question from the Australia Infomatics Competition. TL;DR - Each line of input contains two numbers, representing a mutual friendship relationship. The output needs to be the ...

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:
...

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 ...

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 ...

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 ...

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 ...

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 ...

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 ...

I am requesting a review for my solution to this problem from exercism.io. I'm posting it here since there is not always input on solution submitted through exercism.
The problem is as stated:
...

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.
...

Continuing where I left off previously to solve the problem described here, I've now solved the same using dynamic programming (following Tikhon Jelvis blog on DP).
To refresh, the challenge is to ...

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 ...

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 ...

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) ...

Project Euler - 22
Names scores
Using names.txt (right click and 'Save Link/Target As...'), a 46K text
file containing over five-thousand first names, begin ...

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 ...

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 ...

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: ...

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 ...

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 ...

- python
- java
- performance
- algorithm
- time-limit-exceeded
- c
- beginner
- c#
- strings
- python-3.x
- primes
- javascript
- c
- python-2.x
- ruby
- haskell
- interview-questions
- array
- c 11
- functional-programming
- mathematics
- recursion
- palindrome
- dynamic-programming
- combinatorics

- Why do some games persistently have mostly one viable strategy, while others can have many?
- Why don't bond makers just get loans?
- Simple Addition
- How do I mount this towel rack that was ripped off the wall?
- Kid throwing ice cream cone back to the vendor
- How to ensure the safety of a surface base on Europa?
- Is this news article from 1912, essentially explaining climate change, real?
- Hunting Season is Open!
- How can prostitution be made acceptable in a religiously conservative society?
- Is there an effect comparable to Dimensional Anchor in 5e?
- Purpose of [ -n "$PS1" ] in bashrc
- Players constantly capture enemies and question them, how to deal with it?
- Why do airliners have to park so accurately?
- Late 1960's Comic Book with H shaped space ship
- Safe for cats to drink from the aquarium?
- Processing XYZ data from a large file
- Alien Number System
- How should I store "unknown" and "missing" values in a variable, while still retaining the difference between "unknown" and "missing"?
- Rotating Standard Graphs
- Optimal strategy for cutting a sausage?
- Why did I have to wave my hand in front of my ID card?
- I was inspired to create a third (and not final) anagram puzzle
- When someone's ability to pay is suspect, why would it make sense to give them more expensive credit?
- Multiple alignment in math mode without much space