**2.034 programming-challenge questions.**

Warning
Wall of text, little bit of code. This question is about as much as introducing the language as it is about whether or not I still know how to write the language.
Introduction
Programmable ...

With reference to my source files, published in the git repository
soc-testing
I did my best effort at coding, based on 30 years of experience, so I would like to know what I did wrong with my ...

I have managed to solve the 7th Project Euler problem, however I think it can be improved by a lot, I am by no means a professional programmer or even consider myself really good at it. Any ...

Your program is to use the brute-force approach in order to find the answer to Life, the Universe, and Everything. More precisely, rewrite small numbers from input to output. Stop processing input ...

From LeetCode medium 3. Longest Substring Without Repeating Characters:
Given a string, find the length of the longest substring without repeating characters.
Examples:
Given "abcabcbb", ...

I am trying to solve this problem. The problem is to sort a linked list containing only 0s, 1s and 2s by changing their links.
Sort a linked list of 0s, 1s and 2s by changing links Given a linked
...

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

I was solving Project Euler Problem #52:
It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order.
Find the smallest positive ...

I have solved a spoj question CLASS LEADER. For each test case there are n students and a paper will be given to student m and now the game starts, the student m will pass the paper by o positions ...

This challenge was pretty simple - be given the coordinates of a king and a queen on a chess board and determine if the king is in check.
Input is the number of test cases with each test case on a ...

An array is said to be hollow if it contains 3 or more zeros in the
middle that are preceded and followed by the same number of non-zero
elements. Write a function named ...

I am working on the "Bovine Shuffle" problem from the December 2017 USA Computing Olympiad, and have got it to work for every test case beside two. When I run these two cases on my own computer, they ...

I was solving a problem 20, Factorial Digit Sum, on Project Euler.
Factorial Digits Sum
\$n!\$ means \$n \cdot (n − 1) \cdot \ldots \cdot 3 \cdot 2 \cdot 1\$
For example, \$10! = 10 \cdot ...

I am trying to solve a question from array section:
You are given an array of N integers, A1, A2 ,…, AN. Return maximum
value of f(i, j) for all 1 ≤ i, j ≤ N.
f(i, j) is defined as |A[i] -...

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

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

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

I am doing one kata on codewars:
Consider a sequence u where u is defined as follows:
The number u(0) = 1 is the first one in u. For each x in u, then y = 2
* x + 1 and z = 3 * x + 1 must be ...

Project Euler Problem #12:
The sequence of triangle numbers is generated by adding the natural
numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7
= 28. The first ten terms ...

I'm using some old USA Computing Olympiad (USACO) problems to help teach me programming. This is the second one I've posted, I hope that's okay -- let me know if this is considered abusing the system. ...

I'm solving HackerRank "Stacks: Balanced Brackets" in Python.
A bracket is considered to be any one of the following characters: (,
...

Description:
Design a book library which maintains the book inventory.
The library should allow an user to favorite/un-favorite
book. The library should allow an user to rent a book for
a given ...

Project Euler problem 54 asks:
The file, poker.txt, contains one-thousand random hands dealt to two players. Each line of the file contains ten cards (separated by a single space): the first five ...

This is a question from GeeksForGeeks
Given an array of integers, find a combination of four elements in the
array whose sum is equal to a given value X.
Input: First line consists of T test ...

The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:
1, 3, 6, 10, 15, 21, 28, ...

I read the solution to this question, which seems to be the same target. My solution is (I'm sure) not the quickest, but some test case is apparently taking longer than 4s. I did a test case with 10,...

This is my solution to the Equal Stacks problem on HackerRank. I thinks it's really messy and slow. could you give me some thoughts about how to optimize given code and algorithm(i'm pretty sure ...

I'm using some old USA Computing Olympiad (USACO) problems to help teach me. This is the "Milking order" problem:
Farmer John has \$N\$ cows (\$1≤N≤10^5\$), numbered \$1…N\$. He has made \$M\$ ...

I am solving interview questions from here.
Problem : Given a N cross M matrix in which each row is sorted, find the overall median of the matrix. Assume N*M is odd.
Note: No extra memory is ...

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

I want to get familiar with PyTorch and decided to implement a simple neural network that is essentially a logistic regression classifier to solve the Dogs vs. Cats problem.
I move 5000 random ...

I'm given N integers. I need to find the maximum number of unique integers among all the possible contiguous subarrays of size M.
...

As part of learning Haskell, I'm solving few problems, usually solved imperatively.
I've come up with a naive solution for the problem described here, which is to find a sequence in which to burst a ...

I am solving interview questions from here.
Problem : Print concentric rectangular pattern in a 2d matrix. The outermost rectangle is formed by A, then the next outermost is formed by A-1 and so on....

Challenge Story:
"7777...8?!??!", exclaimed Bob, "I missed it again! Argh!" Every time there's an interesting number coming up, he notices and then promptly forgets. Who doesn't like catching ...

I am solving interview question from here.
Problem : Given a set of digits (A) in sorted order, find how many numbers of length B are possible whose value is less than number C.
Constraints: 1 ...

The problem I am trying to solve is this. Apples fall at various offsets relative to an apple tree at position a, and oranges fall at various given offsets relative to an orange tree at position b. ...

Assignment Description:
Make a web application that compares starships based upon the Star Wars API.
There shall be:
A label "Select two Starships from the dropdown lists to compare".
Two dropdown-...

You are given a list of \$N\$ people who are attending ACM-ICPC World Finals. Each of them are either well versed in a topic or they are not. Find out the maximum number of topics a 2-person team can ...

Project Euler Problem #12
The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would ...

I was trying to implement method number 2, from this article.
Method 2 (Use temporary array) K largest elements from arr[0..n-1]
Store the first k elements in a temporary array temp[0..k-1]....

This is Merge Intervals problem from www.interviewbit.com
Problem : Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that
...

I tried this spoj problem and solved it using Dynamic Programming, but I was getting Time Limit Exceeded. The challenge is to count the number of occurrences of the subsequence "KEK" in each input ...

Given an array of integers, sort the array into a wave like array and
return it, In other words, arrange the elements into a sequence such
that a1 >= a2 <= a3 >= a4 <= a5.....
Example
...

This question was presented to me, adapted from Project Euler #8. The goal is to find the N adjacent digits in the 1000-digit number that have the greatest product. Range of N: 10 <= N <= 50. ...

The code below is for Hackerrank competition. Seems that it works correctly but performs very slowly and because of it can't pass some tests.
The task is to find the maximum GCD of all possible pairs ...

I am relatively new to python and I am still trying to learn the basics of the language. I stumbled upon a question which asks you to rearrange the list by modifying the original. What you are ...

TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it returns a short URL.Design the encode and ...

I tried to make a python code that would answer the Joseph problem. I really had a hard time with this and the try blocks was the only thing I could come up with. Can anyone tell me if the way I did ...

I am trying to solve a problem as described below:
You are given an input of a n*m forest.
You have to answer a group of inquiries. Your task is to return the
number of trees for every ...

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

- Not paid for work, contract promised but not given
- Runaway argument? with \newcommand[2]
- In trouble with CDF graph
- How to deal with discussions about finances with SO without it escalating?
- How to use Nearest as a lookup function?
- Are there shanty towns in Paris?
- Should UTF-8 CSV files contain a BOM?
- Why is the movie named "Knight of Cups"?
- Is it possible to bank out Kernal in Commodore PET, VIC-20 or 264 series computers?
- If a triangle can be displaced without distortion, must the surface have constant curvature?
- An Archaic English Rap
- What is on/in my lens?
- Can Contingency be used with a spell cast from an Ioun Stone?
- Bigtable do not automatically break lines of text containing dots
- PhD student failing
- Does casting a spell from an Ioun Stone/Ring of Spell Storing require components?
- Were external floppy drives for Atari ST and Amiga inter-compatible?
- How do I apply integrating factor to solve this differential equation?
- What advantages do students have who learn how to touch type?
- Can my invisible rogue search an opponent for an item without ending the Invisibility spell?
- Are there any alternatives to the `find` command on linux for SunOS?
- Integers sorted by their digital roots
- Does everything have to be accurate?
- Why is the topological definition of continuous the way it is?