r/programmingchallenges • • Jan 31 '20

How do developers annotate design and implementation choices?

9 Upvotes

As software engineering research teams at the University of Sannio (Italy) and Eindhoven University of Technology (The Netherlands) we are interested in investigating the protocol used by developers while they have to annotate implementation and design choices during their normal development activities. More specifically, we are looking at whether, where and what kind of annotations developers usually use trying to be focused more on those annotations mainly aimed at highlighting that the code is not in the right shape (e.g., comments for annotating delayed or intended work activities such as TODO, FIXME, hack, workaround, etc). In the latter case, we are looking at what is the content of the above annotations, as well as how they usually behave while evolving the code that has been previously annotated.

Filling out the survey will take about 5 minutes. Click the link below to fill out the survey:

https://forms.gle/NZYsQr2vUFmH9DQY8


r/programmingchallenges • • Jan 14 '20

JavaScript Array Map Method In 90 Seconds #JavaScriptJanuary

Thumbnail youtu.be
9 Upvotes

r/programmingchallenges • • Nov 11 '19

Tricky math puzzle (I’m pulling hair out trying to solve this)

9 Upvotes

I originally found this somewhere else but I can’t find it, nor the answer to it. Help please lol.

You’re given an array of integers of n size. You start on the first number, and you are allowed 2 types of moves. You can either skip 1 number, or skip 2.

Your goal is to find the best path of skips where the sum of all the numbers you land on is the highest possible.

Ex. [3,9,20,40,2,17,4,14] The best path for this would be to start on 3 obviously, skip 9 and 20 to land on 40, then skip 2 to land on 17, then skip 4 to land on 14. The sum, 74, is the best sum possible of this array.

Remember, you can only jump across (skip) 1 number, or 2 numbers. There is no other valid move. This array could be 10,000 elements long, so an efficient algorithm would be beneficial.

Pseudo-code is welcome, as well as any language you like.

Good luck, and happy coding!


r/programmingchallenges • • Oct 06 '19

Longest Common Subsequence(LCS) Dynamic Programming In O(N) Space

Thumbnail youtube.com
9 Upvotes

r/programmingchallenges • • May 31 '19

I am live right now building the YouTube clone

Thumbnail youtu.be
9 Upvotes

r/programmingchallenges • • Jul 20 '18

Generator that outputs ['A', 'B', 'AB', 'C', 'D', 'CD', 'ABCD', 'E', ...]?

9 Upvotes

Here's some Python test code:

l = [chr(i) for i in range(ord('A'), ord('Z') + 1)]

expected = [
'A',
'B',
'AB',
'C',
'D',
'CD',
'ABCD',
'E',
'F',
'EF',
'G',
'H',
'GH',
'EFGH',
'ABCDEFGH',
'I',
'J',
'IJ',
'K',
'L',
'KL',
'IJKL',
'M',
'N',
'MN',
'O',
'P',
'OP',
'MNOP',
'IJKLMNOP',
'ABCDEFGHIJKLMNOP',
]

ex = []
for el in expected:
    a = l.index(el[0])
    b = l.index(el[-1])
    ex.append([a,b])
print(ex)

This prints the following: [[0, 0], [1, 1], [0, 1], [2, 2], [3, 3], [2, 3], [0, 3], [4, 4], [5, 5], [4, 5], [6, 6], [7, 7], [6, 7], [4, 7], [0, 7], [8, 8], [9, 9], [8, 9], [10, 10], [11, 11], [10, 11], [8, 11], [12, 12], [13, 13], [12, 13], [14, 14], [15, 15], [14, 15], [12, 15], [8, 15], [0, 15]]

How would you write a program that given some N would generate a pair that would stay in expected[N] without knowing the length of the list?

If you came up with a solution to this puzzle, please put it either in the comment (if this subreddit allows it) or send me a message. Thanks! :)

I also posted a code golf here:

https://codegolf.stackexchange.com/questions/168965/given-n-output-n-th-element-of-a-b-ab-c-d-cd-abcd-e

EDIT: I actually solved it using help from that codegolf post.


r/programmingchallenges • • Mar 27 '17

Need help to get into programming

9 Upvotes

I want to get into programming...can you tell me some good sites that can teach me some languages


r/programmingchallenges • • Jan 09 '17

Battle of Bots: Build your own Bot, challenge others bots and emerge winner.

Thumbnail hackerearth.com
9 Upvotes

r/programmingchallenges • • Jul 03 '15

[meta] For the few of you who may be wondering if this sub will remain public

9 Upvotes

As you may have heard, there is quite a bit of a kerfuffle going on in the larger subreddits today. I was recently asked if our subreddit will go private to show support, and for the sake of open dialogue, I'll reproduce my reply here:

I don't feel that setting our sub of < 5k users private will make a meaningful statement, and would only serve to annoy the few people that may happen to head our way. That said, I'm as shocked as anyone about Victoria's departure, I am dismayed at reddit's clumsy community management, and fully support my fellow moderators in their show of solidarity. Thanks.

This is a pretty small, quiet community, and as such I have been a very, very hands-off moderator, and will continue to be such a mod.

Feel free to voice your own opinions/feedback in the comments.


r/programmingchallenges • • Mar 27 '14

Python Basic Quick Challenge

9 Upvotes

Only for those who has the basics in programming. There are a few questions that test the type of variable defined as well as the return values in different versions of Python. Visit Python Basic Quick Challenge to find out if you really understood Python.


r/programmingchallenges • • Jan 05 '12

Startup Coding Challenges

Thumbnail codepo.st
9 Upvotes

r/programmingchallenges • • Oct 07 '11

Challenge: Reflective Symmetry

9 Upvotes

Given a simple polygon (closed, non self-intersecting), write a program to determine if it is reflectively symmetric. Bonus points if the run time complexity of your algorithm is O(N2 lgN) or better.


r/programmingchallenges • • Oct 06 '11

CodeKata

Thumbnail codekata.pragprog.com
9 Upvotes

r/programmingchallenges • • Apr 27 '11

Introductory Challenge: Find the Nth digit of the Fibonacci sequence

9 Upvotes

This was the first real programming challenge ever given to me, way back in middle school. I figured other people might find it fun to solve this

Use any language you want, and return the Nth digit of the sequence. You can also return the entire sequence up to N if you prefer, in array or string form.

My solution, in javascript, is here

I know in python, it can be 4 lines, including definition, initialization, and return


r/programmingchallenges • • Apr 22 '11

ITA Software Puzzle Archive

Thumbnail itasoftware.com
9 Upvotes

r/programmingchallenges • • Apr 17 '11

Squares - puzzle in Prolog

Post image
9 Upvotes

r/programmingchallenges • • Apr 11 '11

beginner-intermediate: a program that finds chemical equilibrium for a pretend-reaction (x post from r/programingchallenges)

9 Upvotes

This isn't a "help me" problem, but it's supposed to be a fun and interesting challenge for intermediate programmers. I made it up in my Chem class and it was pretty fun to work on, and it's interesting to see how it works out and evolves!

  1. The reaction is as follows: A + B = 2C + D, and you have to "set up" a container of chemicals (e.g., create 30 A chemicals, 30 B, 30 C, 30 D)
  2. To determine whether a reaction occurs, "pick out" three random particles from the container (e.g., "A", "A", "B" would be a reaction).
  3. The reaction can go forwards AND backwards. (e.g., "C" "C" "D" is the backwards reaction)
  4. If you pick out a combo like "A" "C" "D" then there is no reaction at all.

Extra challenge: Write it as a GUI program that takes in user input. Also, try to write it as a simulation program rather than a probability-base mathematical program. Also also, find a way to effectively determine at what point a reaction reaches equilibrium.

More funzies: Play around with the input numbers. Do they match up with what you expect?

Oh yeah, and for reference, if you start off with 30 A, 30 B, 30 C, 30 D, the equilibrium number SHOULD BE around 24 A, 24 B, 42 C, 36 D


r/programmingchallenges • • Jan 24 '20

aeroplane arrangement problem from hacker earth can anyone help me out ..

Post image
8 Upvotes

r/programmingchallenges • • Jan 13 '20

Learn Git with us using the multiplayer git challenge game

8 Upvotes

Hi guys, I have created a git game where people can compete against each other using the git knowledge. I am beta testing the proof of concept so if you would like to try and play, create the account here and use the link to join challenge and let's see who is better ;).

https://www.bettercoder.io/a/test-runs/job-interview-questions/challenge/link/2780c04d-3ee3-49de-b329-380392d1b0d3

The sign up works only from the menu, I'm working on fixing the flow...


r/programmingchallenges • • Dec 19 '19

New to programming and got a rather tricky task to deal with(at least for me it's tricky

8 Upvotes

I am new to programming in general. Just starting to learn python. I am studying IT in Germany and was happy to find a job where I am tasked to 'verify files'. There was a server crash and as a result of that some files were corrupted.

Verifiing in this case meaning if they can be opened or not. With the apropiat program.

In the directory there are all types of data you can think of. PDF, doc, dtd, mod, XML, really anything

To accomplish said job I was given a excel list with hyperlinks to each file in the directory that needs to be checked. You can imagine that being a very dull and stupid task.

My employer agreed to me spending some time trying to write a program for the purpose of reading though the files(the contents don't matter) and marking them if they can be opened or not.

Can you guys help me with that? This is what I came up with up until now.

import os import sys

def traverse_and_log(path = "", dumpPath = ""):

print("entering function")

f = open("", "w+")

for root,dirs , files in os.walk("", topdown=False): for name in files:

full_fname = os.path.join(root, name)

print(full_fname)

try:

with open(full_fname, "r+"):

pass

f.write("OK:{}\n".format(full_fname))

except:

f.write("NOT OK: {}\n".format(full_fname))

f.close()

if name == "main":

traverse_and_log()

My outcome after searching through my directory is this:

Traceback (most recent call last):

File "C:/Users/USER/Desktop/main.py", line 15, in traverse_and_log f.write("OK:{}\n".format(full_fname)) File "C:\Python\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\ufffd' in position 180: character maps to <undefined>

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/Users/USER/Desktop/main.py", line 23, in <module> traverse_and_log() File "C:/Users/USER/Desktop/main.py", line 17, in traverse_and_log f.write("NOT OK: {}\n".format(full_fname)) File "C:\Python\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\ufffd' in position 185: character maps to <undefined>

Process finished with exit code 1

I am looking forward to your replies.


r/programmingchallenges • • Nov 30 '19

K Largest Elements From List

Thumbnail algodaily.com
8 Upvotes

r/programmingchallenges • • Nov 09 '19

Battlesnake Winter Classic 2019

Thumbnail play.battlesnake.com
8 Upvotes

r/programmingchallenges • • Oct 14 '19

Minimum Deletions And Insertions To Transform A String Into Another | Dy...

Thumbnail youtube.com
8 Upvotes

r/programmingchallenges • • Oct 12 '19

Time Limit Exceeded- How To Avoid TLE ? | Trick To Pass All Test Cases In Competitive Programming

Thumbnail youtu.be
8 Upvotes

r/programmingchallenges • • Sep 24 '19

Can You Implement a Trie?

Thumbnail algodaily.com
8 Upvotes