Okay, here's one with a story :) Let's see if this is entertaining enough :D

Here is a problem that involves being jerk.

You receive a parking ticket and decide to pay in the least
convient way possible... change. This decision comes to mind
because the tickets are in strange amounts because they use
the cents portion for some kind of internal encoding.

You decide to pay all in pennies but when you start to collect
them someone informs you that although change will be accepted,
if the counts of coins exceed the quantities required for a wrapper
then you must roll them.

US Coinage count to a roll
0.01 = 50
0.05 = 40
0.10 = 50
0.25 = 40
0.50 = 20
$1.00 = 25 (small) or 20 (large)

Question 1.
How many rolls and free coins of each can you provide to pay your
$100.37 ticket in order to use the highest count of unrolled coins?

Considering that a ticket can cost anywhere from $1.00 to $250.00.
You start telling everyone else about your plan and they decide to
play too, so you calculate how they should pay as well.

For example, 45 pennies 21 nickles for a $1.00 ticket might be
pretty obnoxious :).

Question 2. Which fine amount (in that range) would allow you to
provide the highest number of unrolled coins?

Question 3. The parking authority figures out what you are doing
and decides to change things up by hiring you. Your job is to
determine the best fine values to get paid in the least amount of
unrolled coins. What are those amounts what are those amounts (still
within that range of $1.00 to $250.00)

@Lossberg by the way, I do a here, you can look at the origination of it all the way back the 'Ninety-Nine Bottles of Beer" challenge. qoto.org/@Absinthe/10280565958

Feel free to play at any of them that interest you. There is no timebox on these. Watch for the tag and include it on any answers you offer to any of them.

Okay folks, this should be simple, but maybe not.

The goal is to write a function that takes a positive integer and returns a list of its prime factors. So if you did 12 you should get the list [2, 2, 3]

As neither 1 nor zero are prime, as a result should return an empty list.

This is taken from a , so if you have not done this one I encourage you to do so. If you are not into then solve it however you like.

As long as I continue working on the I will not be posting a new

However, I encourage you all to give the a try. You don't have to do them all, though I would recommend doing them in order. You can even go back and do them from previous years.

adventofcode.com/

Okay, this isn't me, but consider doing this this month:

It is the Advent of Code for 2019
Unfortunately the fediverse is not a supporter or OAth so you will have to use Twitter, Google, Github to login.

adventofcode.com/2019

I shall be lazy and only do a freebie.

This problem was asked by Microsoft.

Given a 2D matrix of characters and a target word, write a function that returns whether the word can be found in the matrix by going left-to-right, or up-to-down.

For example, given the following matrix:

[['F', 'A', 'C', 'I'],
['O', 'B', 'Q', 'P'],
['A', 'N', 'O', 'B'],
['M', 'A', 'S', 'S']]
and the target word 'FOAM', you should return true, since it's the leftmost column. Similarly, given the target word 'MASS', you should return true, since it's the last row.


okay, here's a freebie!!

This problem was asked by Facebook.

Given a multiset of integers, return whether it can be partitioned into two subsets whose sums are the same.

For example, given the multiset {15, 5, 20, 10, 35, 15, 10}, it would return true, since we can split it up into {15, 5, 10, 15, 10} and {20, 35}, which both add up to 55.

Given the multiset {15, 5, 20, 10, 35}, it would return false, since we can't split it up into two subsets that add up to the same sum.

Okay, here is a fun one. We've all seen Fibonacci sequences. But they are all played out. Let's look at a different sequence. They are called Hamming Numbers after Richard Hamming, who proposed the problem of finding computer algorithms for generating these numbers in ascending order.

For number H is equal to 2**i * 3**j * 2**k where i,k,k are all non negative.

For example
2**0 * 3**0 * 5**0 = 1
2**1 * 3**0 * 5**0 = 2
2**0 * 3**1 * 5**0 = 3
2**2 * 3**0 * 5**0 = 4
2**0 * 3**0 * 5**1 = 5
2**2 * 3**1 * 5**0 = 6
2**3 * 3**0 * 5**0 = 8

So hopefully that explains what the sequence looks like. Your challenge, if you choose to accept it is to generate the first 25 of them. An arbitrary nth one such as 1700th. And given a number X determine if it is or is not a valid hamming number.

Here is the wiki article on them:

en.wikipedia.org/wiki/Regular_

Okay, here is one before the weekend.

Conway's Game of Life. It is a simple concept. Set up some cool patterns and let it run on a good cycle. I just did it, using '*' and ' ' but feel free to do it graphically if you prefer. Here are the rules, and my code is in the same repo so let that be a spoiler warning:

git.qoto.org/Absinthe/life-con

I borrowed this one from codewars

Snail Sort
Given an n x n array, return the array elements arranged from outermost elements to the middle element, traveling clockwise.

array = [[1,2,3],
[4,5,6],
[7,8,9]]
snail(array) #=> [1,2,3,6,9,8,7,4,5]
For better understanding, please follow the numbers of the next array consecutively:

array = [[1,2,3],
[8,9,4],
[7,6,5]]
snail(array) #=> [1,2,3,4,5,6,7,8,9]
This image will illustrate things more clearly:

NOTE: The idea is not sort the elements from the lowest value to the highest; the idea is to traverse the 2-d array in a clockwise snailshell pattern.

Here's a freebie!

This problem was asked by Google.

Given a list of integers S and a target number k, write a function that returns a subset of S that adds up to k. If such a subset cannot be made, then return null.

Integers can appear more than once in the list. You may assume all numbers in the list are positive.

For example, given S = [12, 1, 61, 5, 9, 2] and k = 24, return [12, 9, 2, 1] since it sums up to 24.

okay, this is not exactly a but I hope you hate this problem as much as I did...

The problem is not just getting the right solution, but getting it in under the running timeout of 12000 ms. Good luck.

codewars.com/kata/54d81488b981

Kind of feels like I am phoning this one in, but I really liked this puzzle and hadn't really seen it before. However, if you have already seen this (and it is likely that you have) feel free to just ignore it.

Given a short message containing no more than 10 unique letters
written in the form of a simple equasion. Show the numeric values
for the letters to make it true. No letter that starts a word can
have the value Zero.

For example:

I + LOVE + YOU == DORA
1 + 2784 + 975 == 3760

Here is an interesting that is true in both cases, and will have only one solution:

ONE + TWO + FIVE + NINE + ELEVEN + TWELVE + FIFTY = NINETY

Okay, here's one. I just finished helping someone worth through this. So it's pretty fun.

Write a program in Python, that can accept a paragraph string and and page
width and return an array of left AND right justified strings. NOTE: No words
should be broken, the beginning and end of the line should be characters).

You should provide instructions on how to execute your program and provide a
sample output.

Example:

Sample input:

Paragraph = "This is a sample text but a complicated problem to be solved, so
we are adding more text to see that it actually works."

Page Width = 20

Output should look like this:

Array [1] = "This is a sample"
Array [2] = "text but a"
Array [3] = "complicated problem"
Array [4] = "to be solved, so we"
Array [5] = "are adding more text"
Array [6] = "to see that it"
Array [7] = "actually works.”

Wow, lots of followers today!

If you are interested in any of my coding challenges they should all be tagged with :

If you put that in your search and scroll to to bottom you will see my original proposal. Here is a link with the explanation of where my head is at. The ones I post that I call freebies, are from a subscription to Job Interview problems, and they should be a little tricky, but are usually rated as easy, medium or hard.

qoto.org/@Absinthe/10280565958

Today's Freebie. It's marked as easy.

This problem was asked by Amazon.

Run-length encoding is a fast and simple method of encoding strings. The basic idea is to represent repeated successive characters as a single count and character. For example, the string "AAAABBBCCDAA" would be encoded as "4A3B2C1D2A".

Implement run-length encoding and decoding. You can assume the string to be encoded have no digits and consists solely of alphabetic characters. You can assume the string to be decoded is valid.

Here's a Freebie, it is marked as "Easy"

This problem was asked by Facebook.

Given a string of round, curly, and square open and closing brackets, return whether the brackets are balanced (well-formed).

For example, given the string "([])[]({})", you should return true.

Given the string "([)]" or "((()", you should return false.


Here's a freebie!

This problem was asked by Snapchat.

Given an array of time intervals (start, end) for classroom lectures (possibly overlapping), find the minimum number of rooms required.

For example, given [(30, 75), (0, 50), (60, 150)], you should return 2.

Here is one I have been playing with.

Factorials and Fibonacci numbers are traditionally used as examples of recursive functions.

Let's see them done without recursion with reasonable timing.

I apologize for not coming up with a new one this week, but I will post a few freebies.

I discovered discord, and I spent too much free time helping 8th graders do their home work :) Or so it would appear.

Show more
Qoto Mastodon

QOTO: Question Others to Teach Ourselves. A STEM-oriented instance.

No hate, No censorship. Be kind, be respectful

We federate with all servers: we don't block any servers.