Programming Challenges
- [Medium] String Decompression Solutions Counter
Given a compressed string, give the number of ways it can be decompressed.
- A compressed string is a string where substrings of repeated characters are changed to a format similar to aaa -> a3
- For example for the string aaabbhhhh33aaa the compressed string would be a3b2h432a3
As an example of counting decompressing options. Say you have the input
a333b2
. This can be read asa333 b2
ora3 33 b2
so you would need to return the value2
as there are 2 options.---
You must accept the input as a command line argument (entered when your app is ran) and print out the result
(It will be called like node
main.js aaaaa
or however else to run apps in your language)You can use the solution tester in this post to test you followed the correct format https://programming.dev/post/1805174
---
Checking through the solutions of last weeks problems should be happening
this weekendmonday + tuesday. Been getting too much work and theres a game jam thats been going on but should be able to go through them all then. I may do the easy one last since it cant be checked using the solutions tester so that one will take a bit longer.Will also try to go through and give solutions to these ones as well on the weekend and will try to do solutions as soon as possible from now on so you can see if you failed the test cases. For the ones done last week, after I go through them all ill give 1 extra day from then on for any resubmissions
- [Easy] String Compression
Given a string, compress substrings of repeated characters in to a format similar to aaa -> a3
For example for the string
aaabbhhhh33aaa
the expected output would bea3b2h432a3
---
You must accept the input as a command line argument (entered when your app is ran) and print out the result
(It will be called like
node main.js aaaaa
or however else to run apps in your language)You can use the solution tester in this post to test you followed the correct format https://programming.dev/post/1805174
Any programming language may be used. 1 point will be given if you pass all the test cases with 1 bonus point going to whoevers performs the quickest and 1 for whoever can get the least amount of characters
To submit put the code and the language you used below
---
People who have completed the challenge:
- @PoolloverNathan@programming.dev -
N/A
-84 chars
(javascript) - @nieceandtows@programming.dev -
0.011s
-385 chars
(python) - @brie@beehaw.org
0.003s
-487 chars
\(c) (fastest)0.01s
-60 chars
(javascript) (shortest)
- @SleveMcDichael@programming.dev -
0.005s
-530 chars
(rust) - @shape-warrior-t@kbin.social -
0.191s
-566 chars
(python) - @Andy@programming.dev -
0.053s
-359 chars
(factor) If you submitted in factor, ruby, cobol, etc. itll take me a bit longer to check since I havent set up running those yet. Should be soon
- @PoolloverNathan@programming.dev -
- [Hard] Longest Valid Bracket Pattern
Given some assortment of brackets, you must find the largest substring that is a valid matching bracket pattern
- A bracket match is an opening and closing version of the same kind of bracket beside each other ()
- If a bracket matches then outer brackets can also match (())
- The valid brackets are ()[]{}
For example for the input
{([])()[(])}()]
the answer would be([])()
as that is the largest substring that has all matches---
You must accept the input as a command line argument (entered when your app is ran) and print out the result
(It will be called like
node main.js [(]()
or however else to run apps in your language)You can use the solution tester in this post to test you followed the correct format https://programming.dev/post/1805174
Any programming language may be used. 3 points will be given if you pass all the test cases with 1 bonus point going to whoevers performs the quickest and 1 for whoever can get the least amount of characters
To submit put the code and the language you used below
---
People who completed the challenge:
- @SleveMcDichael@programming.dev -
6.64s
-1203 chars
(rust) - @shape-warrior-t@kbin.social -
0.148s
-1251 chars
(python) - @nieceandtows@programming.dev -
0.008s
-1268 chars
(python) - @brie@beehaw.org -
0.001s
-1516 chars
(c\) (fastest) - @Quasari@programming.dev
0.031s
-317 chars
(javascript) (shortest)
submissions open for another day (since the last time I edited the post)
- [Med] Bracket Match Generation
Bracket Inc. wants to ship out new products using their excess brackets. They have tasked you with generating every possible assortment of brackets for some n brackets where the brackets will match
- A bracket match is an opening and closing version of the same kind of bracket beside each other
()
- If a bracket matches then outer brackets can also match
(())
- n will be an even number
- The valid brackets are ()[]{}
For example for n = 4 the options are
- ()()
- (())
- [][]
- [[]]
- {}{}
- {\{\}}
- \
- ()[]
- (){}
- {}()
- []{}
- {}[]
- ({})
- {()}
- ([])
- [()]
- {[]}
- [{}]
You must accept n as a command line argument (entered when your app is ran) and print out all of the matches, one per line
(It will be called like
node main.js 4
or however else to run apps in your language)You can use the solution tester in this post to test you followed the correct format https://programming.dev/post/1805174
Any programming language may be used. 2 points will be given if you pass all the test cases with 1 bonus point going to whoevers performs the quickest and 1 for whoever can get the least amount of characters
To submit put the code and the language you used below
- A bracket match is an opening and closing version of the same kind of bracket beside each other
- Programming Challenge Solutions Testergithub.com GitHub - Ategon/P.D-Challenge-Tester: A CLI to test solutions for the https://programming.dev programming challenges community
A CLI to test solutions for the https://programming.dev programming challenges community - GitHub - Ategon/P.D-Challenge-Tester: A CLI to test solutions for the https://programming.dev programming ...
Ive created a js app that can be used to test solutions for the community. Certain ones people made for challenge #1 wont be able to be put through it since they accept user input through entering it while its running rather than command line arguments but ill be enforcing command line argument use going forward
Let me know if theres any issues you find with it. I tested with with javascript, python, and rust and seemed to be working great. There can be differences in runtime when you run the same thing multiple times so ill be taking the median of running it 50 times for the performance score in the challenge
- Mods and Helpers wanted!
Hey everyone,
Currently looking for some more help with this community. Out of all of them I'm running for the instance this one by far takes the most work since it involves checking peoples code against tests.
I'm starting work on some generic testing systems for various languages (will do another post about that soon) that should help reduce the amount of work but if anyone else wants to help me create and run the challenges let me know (or if anyone wants to help out with running the tests with peoples code and giving them results)
Theres a matrix room for this community at https://matrix.to/#/#p.d-challenges:matrix.org
- [Easy] Bracket Simplification
Welcome to the first programming challenge! Three of these will be posted a week and you can complete it in any language you want.
You get a point for completing an easy challenge, 2 for a medium, and 3 for a hard. For each challenge if you solve it in the least amount of characters you get a bonus point, and if your code runs the fastest when I check it you also get a bonus point. (ties mean everyone who tied gets the bonus point although exact duplicate answers wont count)
Ill be posting a leaderboard that will show the people who have the most points every month
Submissions will be open for a week
---
As a new hire of bracket inc., you have been tasked with getting rid of excess brackets lying around the facility. You must simplify a series of brackets so that only brackets that dont have a match remain (a match is an opening and closing bracket of the same type beside each other). The final result should have no matches
As an example for the input
[(({})({)(()}]
the expected output would be[(({)(}]
These are the valid types of brackets:
(){}[]
Your system will be tested against 10 different unknown test cases before it is unleashed on the facility. In order to complete this task you must pass all of the test cases.
Any programming language may be used and to submit an answer reply on this post with the code and the language you coded it in
Edit: Clarification, you must take input in from the user using the program instead of them being hardcoded. (makes it easier to test)
- Welcome to the Programming Challenges community!
This is a community that will have various programming challenges to complete (in any language of your choosing)
Posts will be done three times a week (one easy, one medium, one hard) with the first easy one coming tomorrow
I'm currently running the community until somebody else volunteers but if anyone else wants to manage it let me know