/r/programmingchallenges
Welcome to r/programmingchallenges!
Project Euler is a good site that comes highly recommended by the community here.
For quick, daily challenges, check out /r/dailyprogrammer
Got a link to a good programming challenge? Got a programming challenge you've written yourself? Post it here!
This subreddit is for programming challenges. Got a link to a good tutorial? You should try posting it in r/learnprogramming instead.
Unless it's an integral part of the challenge, please try to stay language-agnostic. It helps reduce the "help me with my programming chores" vibe. This subreddit is not a place to post your programming homework!
If a post does not appear, message the moderators so we can rescue it from the spam filter.
Got a suggestion for r/programmingchallenges? Let me know.
In the meantime, you can try trolling your compiler:
//author: krum
template<int x>
struct Test
{
static void foo()
{
Test<x+1>::foo();
}
};
int main()
{
Test<0>::foo();
}
/r/programmingchallenges
anyone please help me with this馃槶 馃槶
i am giving an exam for a job, and i have been trying to solve it , but i cant do it. Today is the deadline for the submitting the exam. I tried with chatgpt and other ai tools many times, still its is giving wrong and i searched in the internet i couldn't find the solution, people were just posting the same question in the internet and none of them were answered.
Please help,i really want to get this job.
here is the question:
As shown in the diagram, a laser light originates vertically from point 'A' and must reach point 'T'.聽
There are two rotating mirrors that adjust their angles based on a given relationship with theta.聽
Assume that the mirrors are infinite in length. The rotation point of the first mirror is directly above A.聽
The values for x and t are provided in the input file. You need to write a code to determine the theta values聽that will allow the light to reach point T after reflecting off the second mirror.
(C/python)
Sample Test Result:
Input
2
2
Expected Output
54.91
I made a little program that encrypts and decrypts messages, how do you like it?
If someone is interested in or just have too much time you can try encrypt this:
415832ylr97porp32tx97t32siht3297dih32ot32t97grof32tsuj327332ro32noitpyr99n9732ym3297kor9832uoy32sne97m32teht32siht32gnide97r3297re32uoy32f73
Hi! I'm currently struggling with a program in C++ I'm writing. My professor is having us write a program that does two things: 1. ask a user for a positive number, and a negative one to end the program and 2. the sum of all the numbers that were input by the user. I have the first part, but I don't get how to have the program add up all of the positive integers? The number of inputs could be anything, so assigning variable names and using those would probably take way too long and make the code mucky. I've already Googled the issue and didn't find anything specific to what I'm doing. Thanks in advance!
Hello all,my instructor gave me this Java challenge to solve. I have a problem understanding both the problem and what the code must do, especially what is the input, I hope you guys can give me advice and help. The challenge uses java, but its fine if you guys can explain it with other codes.
The problem
Imagine a family: father, mother, daughter, 3.5 years old, and an infant (baby, 8 months). The family lives at a home with 5 rooms and in each room, there are 5 boxes. After the father comes back from the work, all the family members do not have any energy whatsoever, except the baby who sucks the energies out of mom and dad by cuddling them!
After the dinner, the father has 100 energy points, the daughter has 100 energy points, the mother has still no energy, but she can walk from room to room.
Now, the daughter loves to pay hide and seek with her father. At 18:00 they start playing hide and seek with following rules:
路 The family come to room 1 and father starts counting down
路 The daughter can go any room and hide in one of the boxes in any room
路 The mother takes baby and she goes to a random room
路 The father searches every box from room 1 and if he cannot find the daughter he goes to other consecutive rooms and continues searching the daughter
路 Searching a box takes 1 (one) energy point from the father and lasts a minute, except following case:
路 If the mother goes any room number with smaller than or equal to that of daughter鈥檚 room number (say, mother goes to room 2, the daughter goes either room 2,3, etc), the mother hands the baby to the father during his search. This time after the dad starts holding the baby, he loses 2 energy points for every box search after he has taken the baby.
路 Then, when the father finds the daughter he come backs to room 1 and leaves the baby there and immediately mom picks the baby and she goes another random room in the second round of game.
路 If the daughter sees that father holds the baby for 3 times, the daughter starts crying and game over
路 If the father has less than 0 (zero) energy, this also causes of game over
The challenge is to implement this little hide and seek game.
You have to calculate how many minutes this game takes
You have to calculate father鈥檚 energy in the end
Programming Tips:
Write a Person Class with attributes name, which will be replaced with father, mother, etc., energy, room number
Write related get set functions, crying, yelling, hiding functions
Write Hide and Seek Game Class: To simulate the game in the main
Example Output:
Game started at 18:00
Mother at room 5
Daughter at room 1
Daughter is hiding in the box 4
Mother at room 1
Daughter at room 5
Daughter is hiding in the box 1
Mother gave the infant to Father
Mother at room 2
Daughter at room 3
Daughter is hiding in the box 3
Mother gave the infant to Father
Mother at room 1
Daughter at room 2
Daughter is hiding in the box 2
Mother gave the infant to Father
Daughter starts crying please stop the game
Father's left energy is 4
Father and Daughter played 45 minute(s) hide and seek
I go to a school and I'm the only tech competent person in it, anyway the school has a small stationery shop for each grade. the school cannot justify refusing stationery to students if they need it for the day so it works on a system of IOUs. I have to write a program that will work on laptops with python 3.6 and no access to command line, admin or internet downloads. The program must log the date people start a debt, pay back an amount of money and also must add up debts if they take out more than one debt. HELP ME FOR THE SAKE OF JESUS MARY AND JOSEPH I HAVE NO COMMAND LINE
This is perhaps a bit bigger challenge than usual, but bear with me.
The game in question is my creation. It is a game where each player tries to build the longest possible snake. Video rules + example game (3:17) are here: https://youtu.be/NY7ib0mR_ow.
Rulebook and other resources here: https://drive.google.com/open?id=1OufzCUiRhyPFdfWQSEt3PYjHNETfIqRq
The question is simple: who wins with optimal play from both players?
Some insight I have so far:
Which algorithm would you choose? Do you think some machine learning is feasible? What is effective for searching such a broad game tree?
Hi guys,
I'm investigating making the simulation environment that we use in our robotics company more modular and distributable for cluster (or multicore) execution. Basically I'm trying to come up with a solid backbone that multiple programs/simulators can send their info to and this info will be passed on to the relevant modules. You can think of this as an alternative to ROS but with some additional requirements due to the cosimulation nature and speed.
- 3d graphics engines like Unity/Unreal will be interfacing to the backbone by sending 3d world information.
- Since we envision to have different simulators/programs running at the same time and communicating, need to come up with a standardized messaging protocol like protobufs.
- We dont have real time requirements, but actually, we should be able to run things faster than real time.
- We would like to be able to distribute different processes in this system to multiple cores on the same PC or on a cluster.
- The message interface should be easy to maintain due to it's frequently changing structure.
- The status of the list of programs and the information that they produce should be easy to monitor in a centralized way.
So far I have investigated ROS, ROS2, DDS and microservices. I would be glad to hear your experiences with such systems and their suitability for this architecture, and of course the alternatives please.
I'm not a CS guy by nature, but due to our need in the team, I would like to take up this challenge.
THanks in advance
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:
How can i install visual studio 2019 community on chromebook.
I am looking for help to design a website where I can send the link to a customer they fill in the required boxes and hit apply and it will send all the info to me or load onto google calendar. Is this possible?
Check if a string contains the word
word
in it (case insensitive). If you have no idea, I guess you could try
/word/
I honestly have no idea how to attempt this
I am not so great in communication skills. How big of a part does communication play in a programming job? I know I should work on this.
I'm want to make an all in one website (for fun) and I want to add a search engine to it such as google, anyone know an open source search engine I could use. For certain reasons I can't have it open a new tab (so no Google custom search) but anyone no an easy to use/setup search engine to add to websites.
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 ;).
The sign up works only from the menu, I'm working on fixing the flow...
Hey all, I'm hoping someone can shed light. I have a div which is visible at user's choosing. But after form updates etc, it keeps going to the original state of hidden. What's the best method to keep its visibility after a button press etc?
I need Help,
I don鈥檛 know where to ask but I love league of legends but my Eye side is really Bad.
I cant see the Color on the Enemy Minions Health and Color Blind mode is not helping.
Is there a way in the league of legends Coding to Change the Enemy Minions Healthbare Color to Blue because this is a Color I can see.