#toyprogrammingchallenge

Here's a Freebie!

This problem was asked by Stripe.

Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well.

For example, the input [3, 4, -1, 1] should give 2. The input [1, 2, 0] should give 3.

You can modify the input array in-place.

#toyprogrammingchallenge

#python Here's another freebie, I assume it is python specific because they start with a base of python code. But if it makes sense, try it in whatever language you like:

This problem was asked by Google.

Given the root to a binary tree, implement serialize(root), which serializes the tree into a string, and deserialize(s), which deserializes the string back into the tree.

For example, given the following Node class

class Node:

def __init__(self, val, left=None, right=None):

self.val = val

self.left = left

self.right = right

The following test should pass:

node = Node('root', Node('left', Node('left.left')), Node('right'))

assert deserialize(serialize(node)).left.left.val == 'left.left'

re: A Python solution

@Absinthe @zingbretsen

I'm going to do the next one in Elm, working example published at https://ellie-app.com

#toyprogrammingchallenge

I'm going to do the next one in Elm, working example published at https://ellie-app.com

#toyprogrammingchallenge

Good morning and here comes the latest challenge.

https://git.qoto.org/Absinthe/onetonine/blob/master/README.md

The numbers 1 2 3 4 5 6 7 8 9 can have either the operator "+" or "-" placed between them.

As well, if no operator is placed, then the adjoining numbers go together such as 1 2 would

become "12" or 1 2 3 would become "123" and so forth.

The goal is to find the combinations that would make the line calculate up to 100 exactly.

Here is an example: 12 + 3 - 4 + 5 + 67 + 8 + 9 = 100

Would like maybe something other than eval().

Okay, here is another freebie :) I will put in a real one before the end of the weekend.

Basically, you are given a list from which you need to create a new list where each element is the product of all the "OTHER" elements.

I found a few interesting corner cases.

I challenge you to give it a try!

Read the challenge here:

https://git.qoto.org/Absinthe/productnot/blob/master/README.md

My attempt is checked into that repo as well.

Here's another freebie!! I signed up for a programming problem of the day. I got my first one today, rated "easy".

Here's the description of the problem.

https://git.qoto.org/Absinthe/sum-of-number-in-list/blob/master/README.md

My code to solve it, though not clean and delicious, is in that same repo, but certainly give it a crack before peeking. :)

@nergal I am grasping at straws so all suggestions are welcome. I am not sure what you mean on the "etherpads". Pretty much anyone can use whatever language and development environment they like. Or are you suggesting some kind of pair programming?

FWIW, I would be thrilled to see a new programmer maybe get half-way there and ask for some help. Sometimes walking a solution together can open some doors,

@nergal I can go super simple like "Create a Program that accepts 2 numbers and returns the Sum" or "Reverse a string" or "Towers of hanoi" things like that. "Dice toss" or "Card Deck Shuffle" ... just looking for what 1. won't be too easy for those with some experience. 2. Won't be too hard for someone new 3. Be interesting enough that people will want to try it.

How about a guessing game? Or job interview type programming tasks?

@Absinthe

This was a lot of fun decided to do the problem by hand using non brute Force techniques. Attached are all the steps I used to solve the problem including the final solution on the last page.

Total number of coconuts is 3,121 at the start. The number of coconuts they ended up with was the following: 828, 703, 603, 523, 459

If your following the pages I attached the order in which you follow them is "knowns/reduce" then "All valid values" then "final solution"

If you have any favorite Python books, lectures, articles, blog posts, etc. I would appreciate suggestions! I know very little 😋

I'd rather truly understand transferable concepts than work thought syntax tutorials over and over. So info on broad concepts, data structures, algorithms, etc would be great.

I don't have a computer science or mathematics degree, so things that start rudimentary and ramp up as I go would be awesome.

Thanks 🤓

@Absinthe

#toyprogrammingchallenge #python #lisp #c #c++ #cpp #coding #programming

Ready for the next challenge?

"5 Guys and a Bunch of Coconuts"

Here is a link to the text description of the problem.

https://git.qoto.org/Absinthe/coconuts/blob/master/coconuts.txt

That link is to the repo, and my solution is in it as well.

#toyprogrammingchallenge #python #lisp #c #c++ #cpp #coding #programming

Ready for the next challenge?

"5 Guys and a Bunch of Coconuts"

Here is a link to the text description of the problem.

https://git.qoto.org/Absinthe/coconuts/blob/master/coconuts.txt

That link is to the repo, and my solution is in it as well.

Here is a freebie, but I encourage you to give it a try.

I remember back to first year college. Prof said, some day your boss will come to you at 3:15 and ask you to write a sort module and he will need it by 3:30. The answer to this was the bubble sort. the idea being that it might not be the most efficient or elegant sort module, but sure enough it is easy to write. I have been working in the industry since 1989 and to date, no one has ever asked me to write a sort routine. :)

That said, I challenged myself to write one in 15 minutes, in python because I am trying to relearn python. It took a little longer than 15 minutes, but I did comment it, comply with pylint3 and pycodestyle. And I refactored it for modularity.

Give it a shot, see if you can do it without looking it up. It is an awesome feeling when it works.

If you want, here is my results :

https://git.qoto.org/Absinthe/bubblesort

I promise a full one is coming before the weekend is over. Still watching for anyone with one for the Ninety-nine Bottles challenge.

- Website
- http://bradleysmall.com/

Software Engineer, Maker, Woodworker, Soap maker, kombuncha brewer, Beekeeper, Debian Linux user/developer, vim user, vimgolf player, Blender user, what's next!?

Joined Aug 2019