Click here to Skip to main content
15,896,481 members
Everything / Coding challenge

Coding challenge

coding-challenge

Great Reads

by John M. Dlugosz
Here is the real answer to the FizzBuzz interview question
by Alexey Shtykov
Lot of fancy languages were born and have died since I started working in IT, but a few of them continue their pitiful existance.

Latest Articles

by Alexey Shtykov
Lot of fancy languages were born and have died since I started working in IT, but a few of them continue their pitiful existance.
by John M. Dlugosz
Here is the real answer to the FizzBuzz interview question

All Articles

Sort by Score

Coding challenge 

16 Jul 2023 by Graeme_Grant
Homework = good fun. It looks like they have used what you have learned in class. Break down each part into smaller pieces, then it should be easier to code. I'll do one part for you: The program should return a dictionary, where keys are the...
27 Nov 2023 by CPallini
You have to examine the whole list, before giving up the search. Change fromQuote: def linear_Search(name,target): for i in range(len(name)): if name[i]==target: return i else: return -1 todef...
20 May 2018 by John M. Dlugosz
Here is the real answer to the FizzBuzz interview question
13 Feb 2020 by Patrice T
Advice: it don't hurt to put spaces in code. Your condition is wrong: else if (option = -11){ System.out.print("Very Cold"); } It is 'Very Cold' if option is lower or equal to -20 (like -20 -25...
19 Feb 2020 by phil.o
This is a mathematic problem rather than a coding one. If a and b are the sides of the right triangle and c its hypothenuse, the following relations stand: c² = a² + b² => c = sqrt(a² + b²) a² = c² - b² => a = sqrt(c² - b²) b² = c² - a² => b =...
14 Feb 2021 by Patrice T
Quote: im too stupid and i didnt try anything can anyone help me to solve this quetion No, because you don't want help, you want us to do the job and give you a working solution so you can claim it is yours. It is rude of you. For this kind of...
7 May 2022 by Patrice T
Quote: How do I write a write a cod e that prints out the numbers explained below? Looks like you took a most complicated way ! Quote: reversing the string and removing a substring and reversing it again Substring() can remove the ending chars...
16 Jul 2023 by Patrice T
Quote: I haven't really start working on it yet. I don't know how to approach this question. Not a solution to your problem, but something that will help you in the run. Program Development by Stepwise Refinement[^]...
4 Nov 2017 by OriginalGriff
No. Look at the example: SSNE -> ES What you need to do is remove opposites: A North and a South pair, and East and West pair. When you have removed pairs, you can sort.
14 Feb 2018 by CPallini
The FOR loop executes its body then times, you know 1 TO 10 is a way to say 1,2,3,4,5,6,7,8,9,10. In the loop body the use is asked for a number and the entered number is add up to the total. Again, you know SET total TO total + number is a way to say: "take the current value of the total...
14 Feb 2018 by CHill60
Here is this code step by step: SET list TO [3, 6, 9, 13, 17, 21] You have a list of things you are going to do something with. The numbers you are going to do something with are 3,6,9,13,17 and 21 in that order. SET found TO False Set up a variable to signal (flag) to you when you have found...
12 Jul 2018 by CPallini
A new girlfriend! (...sorry...)
12 Jul 2018 by Kornfeld Eliyahu Peter
But seriously - give him a gift card, so he can pick something cool for himself... Add a cake if you want to make it personal...
12 Jul 2018 by Patrice T
We know nothing about what can be its interests. Like others, I guess he might be interested in a new GF :) Quote: I'd want to buy something for a guy who studies programming and he always codes Lets guess he constantly manipulate mathematic concepts and he like it. What about a brain teaser...
12 Jul 2018 by CHill60
Don't know if this is still a thing ...The Code Project Online Store[^]
8 Sep 2019 by Patrice T
Quote: Code is ready and working, but GIT shows incorrect as far as I can see, your usage of 3 spaces as indentation is perfectly legal, but Git want 4 spaces. "indentation is not a multiple of four"
29 Jun 2020 by Patrice T
Quote: do you memorize the codes you write or you just pick it from any place and you write it. Your question is not very clear, but I think I understand what you want. A programming language purpose is to translate an algorithm to plain text...
2 Feb 2021 by OriginalGriff
This is going to probably sound a but brutal, but ... it isn't, not really. Quote: I have no idea about coding That's the problem. Quote: I searched on google a lot That's not the solution. Quote: I still don't manage to get it done like I want...
14 Feb 2021 by KarstenK
Your arent too stupid, because you have aknowledged one part of your problem: your missing knowledge. Read my article How to start ... with some tips and links to start your solution. tip: take care of some design, like classes and functions....
21 Aug 2021 by OriginalGriff
Why do you even try to do Leetcode challenges, if you are just going to ask others to do them for you? 19. Remove Nth Node From End of List[^] While we are more than willing to help those that are stuck, that doesn't mean that we are here to do...
11 Apr 2022 by Greg Utas
I had to do a net search to see what triOsc was, and I found this[^], so I updated your question to add a Java tag. You have shown no code at all. It's unlikely that anyone will help you, because we get "Please write this code for me" questions...
4 May 2022 by OriginalGriff
Basically, don't. Instead pass the Image that the PictureBox is displaying as a parameter to the Constructor of the new form: public partial class FrmItemDetail : Form { public FrmItemDetail(Image pic) { MyPictureBox.Image =...
27 Nov 2023 by Graeme_Grant
Google search is a good place to start. This search has many examples for you: python linear search program - Google[^]
7 Mar 2017 by Richard MacCutchan
See Code Project Quick Answers FAQ[^].
8 Mar 2017 by Member 13046390
Hi,I am working on a python code and require to open an executable which is located in my C drive. I dont want to code something like, file = open("C:\\Documents\\CodeRepo...\\codeplay.exe)I want to use the environment variable called LOCATION_HOME to point to this exe...
8 Mar 2017 by Dave Kreskowiak
You could have easily found the answer yourself just by Googling for "How to resolve an environment variable in python".
8 Mar 2017 by Jochen Arndt
You have to set in the same terminal from where your Python script is started (manually or using another script or batch file) or set it globally (search for "windows set permanent environment variable"). Then useimport ospath = os.environ["LOCATION_HOME"]See also 16.1. os —...
18 Jul 2017 by TheVoidDz
Hello, Recently i have been working on a simple Simulation Code (Discrete Event Simulation) with a single queue and single server and deterministic number of clients with Python , i just want to know if my code is correct or i'm i missing something , because i'm having some difficulites in the...
17 Jul 2017 by Patrice T
Quote: i just want to know if my code is correct or i'm i missing something , As programmer, it is your task to make your code right and to know that it is so. Quote: i'm having some difficulites in the Queue This is not informative, describe the problem, give example. Quote: my code work but...
5 Nov 2017 by Patrice T
Quote: I'am thinking to delete all the same characters which occur together and keep only one of them. Wrong the principle is that N and S are opposite directions, same for E and W. It means that if you have both; a move S will cancel a move N, same with E and W. So SSSNNEW -> SSNEW -> SEW -> S
6 Dec 2017 by Member 13562597
hi i am tryin to make a function that takes an array and multiples each of its values by 2, then returns each multiplied value in a new array, so I can write out the individual values of the original array and the new multiplied one. IE, an array with 2, 4, and 6, I want to make a function...
6 Dec 2017 by Karthik_Mahalingam
class Program { static void Main(string[] args) { int[] inputArray = { 1, 2, 3, 4 }; int[] outputArray = GetArrayMultiply(inputArray, 2); // 2,4,6,8 } static int[] GetArrayMultiply(int[] inputArray, int multiplier) { ...
12 Dec 2017 by Patrice T
Quote: but I don't understand why am I getting a TLE ? I think there is something additional about online judges or STL that I should have known... The reason is simple: With CodeChef challenges, a strait forward answer is never the right answer, even if results are correct. You can consider...
12 Dec 2017 by Dave Kreskowiak
Because your code isn't finishing in the time allotted. Yeah, it may be quicker than the time required on YOUR MACHINE, but your machine isn't the judge. The code has to run better than the time on the machine doing the judging, which may be slower that yours. I can't give you the answer. That...
15 Dec 2017 by OriginalGriff
Do you want a list? For starters, indent it correctly - that is all over the place and that makes it very hard to read and work out what goes where. Then, stop using single character variable names, and use names which are relevant to teh task they are doing. It's a little more typing, but it...
15 Dec 2017 by Patrice T
Learn to indent properly your code, it show its structure and it helps reading and understanding. It also helps spotting structures mistakes. #include using namespace std; int main(){ string s; int i,j,k,n; cin>>s; string u=""; vectorhash(27,0); stackst; ...
14 Feb 2018 by Richard MacCutchan
Please read Code Project Quick Answers FAQ[^]. If you really do not understand the basics then you should get hold of a book, or try some online tutorials. For Python you can start at The Python Tutorial — Python 3.4.8 documentation[^].
3 Jul 2018 by Member 13897314
I'm writing a story where a character solves a cryptic coding puzzle. I'm looking for advice on what an expert coder would do in order to find patterns in code. Would they use software to test code for patterns, just use their eye, how would they test their theories, etc? I want the...
3 Jul 2018 by Patrice T
Quote: I want the character to appear a coding genius who can see patterns / complete the puzzle where others can't. To get you started, have a look at this TV series, 1 of the characters is a mathematician genius, most of the problems solved can be seen as a kind of puzzle. Numbers (TV series)...
23 Jul 2018 by OriginalGriff
So, you've posted this on stack exchange: programming practices - Solving Safe Breaking - Software Engineering Stack Exchange[^] And stack overflow: python - Solving Safe Breaking - Stack Overflow[^] And how because they won't do your homework you bring it here. Guess what? We don't do your...
23 Jul 2018 by Patrice T
Quote: 0 down vote LOL Quote: This question was recently ask in a contest which is now over These contest are especially designed to challenge your skills, so you got the answer: You are unable to solve it. Quote: I tried to solve it by brute force but it give TLE brute force is never the...
7 Aug 2018 by Member 13940683
I work for a small construction company based in Lincoln. We use a programme called Pro-Core in order to organise subcontractors. We have to fill in all of the companies information by hand from their insurances to their numbers and this is very time consuming. I have been tasked with figuring...
7 Aug 2018 by OriginalGriff
Seriously, Chill60 is right: you need to talk to ProCore themselves, and see what they can do to help - it may be that they can point you ate good developers with experience, or pass your details to them to see if they are interested. Alternatively, there is always Hire Freelancers & Find...
22 Aug 2018 by Patrice T
Quote: SOMEONE PLEASE HELP ME SOLVE THIS?!?!?!?! The help you want is us doing your homeWork. You show no attempt to solve the problem yourself, you have no question, you just want us to do your HomeWork. HomeWork problems are simplified versions of the kind of problems you will have to solve...
22 Aug 2018 by Vincent Maverick Durano
READ: Programming Problems and Finding Solutions[^] PS: Adding those exclamation marks on the subject line suggests you are late with your homework, it's rude and no one is interested in that. If you want us to help you, then start doing something by yourself. Show us what you've tried and...
3 Oct 2018 by Svetoslav Angelov
Hello everyone, I'm doing a university project and I want to make a spiral with an ellipse to start following the space in between the spiral from the center until the end of the spiral and then to start doing the same automatically. So my question is how can I make the ellipse following the...
30 Oct 2018 by Nelek
There are a lot of good specialists here, but I am not sure if your search will be that successfull, as most of them already have plenty of work. You might have a try in Work Issues Discussion Boards[^] or The Lounge[^] Good luck
30 Oct 2018 by OriginalGriff
This is not the right site - you are likely to be kicked off as a recruiter. If you want someone to write your code, I suggest you go to Freelancer.com and ask there. But be aware: you get what you pay for. Pay peanuts, get monkeys.
5 Jan 2019 by F-ES Sitecore
Google for how to use html agility pack to scrape links. What you're doing is doubtlessly unethical though.
8 Sep 2019 by martinfilikas
I have made a program, which calculates the area of Circle, Square and Triangle. The code is working if i press "run" command in Pychram. But when i upload it to git i get an email, that shows, the code is completely incorrect. The code: """Ask user a shape and a radius or a side length and...
18 Oct 2019 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Here you go. body{ background-color: black; color: white; }
14 Feb 2020 by Hussainomer
In this case, I have identified my numbers to produce the right results in the console. I have created about three if statements, but whatever number I put in the console using the scanner, it always outputs the first condition and ignores the...
27 May 2020 by Nelek
If you are seriously asking for help, then... yes, it is the right place. (sorry for the apparent lack of trust, we have a lot of spammers and your question look the perfect bait for a later spammer). If you are good on Python, you should be...
28 Jun 2020 by prash3.1415259265
/* so the ques asked is :: Given a Binary Tree, convert it to Binary Search Tree in such a way that keeps the original structure of Binary Tree intact. */ below is my code please tell what is wrong i am unable to contemplate much now,,,, first...
28 Jun 2020 by OriginalGriff
Quote: ps:: i am not riichhhhh.... Doesn't matter - help and advice here is free; we are all volunteers. There is no charge, or you would have had to give us credit card details when you signed up! :laugh: But, your problem is one you can fix:...
29 Jun 2020 by malakkhanani
Hello, I am new in programming world and I'm still learning the basics and I have this question that I didn't find a specific answer for it.. So, if you are a professional programmer and you're using any language you want, while coding, do you...
29 Jun 2020 by OriginalGriff
Neither. I look at the requirements, and convert them into a specification which provides a testable "end point" for the project. That needs to be agreed with the project sponsor to ensure we all know what is being delivered. I then work out what...
5 Aug 2020 by mohamaddibassy123
My class spot takes in an x and y value to create coordinates on my board. I have a function responsible for moving my chess piece from its current set of coordinates to a new set of coordinates by subtracting the starting x and ending x and the...
5 Aug 2020 by KriShna RaJendra N PraSad
Hope the Below link is help. stackoverflow.com/questions/23914583/python-classes-duplicate-instances
22 Oct 2020 by Patrice T
Start with stanford.edu: Learn to Program[^]
2 Feb 2021 by Richard MacCutchan
You may find that Support – Official WordPress.com Customer Support[^] will get you an answer.
14 Feb 2021 by OriginalGriff
Quote: im too stupid and i didnt try anything We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of...
23 Mar 2021 by Patrice T
Quote: While attending Geeks Classes, Shivan ... First of all, this comes from a challenge site, it is a good idea to give link to original page, because in those problems, exact wording matters. Quote: How can I solve this coding problem. The...
30 Jun 2021 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
7 Jul 2021 by Patrice T
Quote: How can I add some additional java code to finish my assignment? We can't do anything for you because you forgot to tell what is your assignment. The 1 line of code will not help us either. Reread your question, it must explain what you...
14 Jul 2021 by Richard MacCutchan
Yes, I expect many people can solve it. However, this site does not provide code to order, or do your homework assignments. We are willing to help fix problems with code you write, but you are expected to do most of the actual work.
15 Jul 2021 by Patrice T
Quote: This is the question came in Capgimini tech 2021 and many coding rounds of many mncs can ayone solve this?? Yes, many can, and I probably can if I want. As senior programmer, I craft solution easily for must problems I encounter. Quote:...
26 Aug 2021 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
19 Sep 2021 by OriginalGriff
Compiling does not mean your code is right! :laugh: Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the email...
19 Sep 2021 by Richard Deeming
Quote: case1: if (label1.Text == Q1) { if ("I am" == textBox1.Text) { MessageBox.Show("Correct"); } else { MessageBox.Show("Incorrect"); goto case1; } ...
22 Oct 2021 by RickZeeland
Yes it's possible, quoting WikiPedia: Quote: In modern PCs the BIOS is stored in rewritable EEPROM or NOR flash memory, allowing the contents to be replaced and modified. This rewriting of the contents is sometimes termed flashing. And this...
9 Nov 2021 by KarstenK
Than it is a very simple packet filter. The first problem is to acquire the packets for sniffing and than tell the decision to the driver and after that you can write a simple function like: BOOL acceptPacketFromPort(int port) { return port ==...
6 Jan 2022 by CHill60
It doesn't matter what the language is, it's about the approach. @OriginalGriff has written an article on how to start that approach - How to Write Code to Solve a Problem, A Beginner's Guide[^] An additional hint I would give - don't attempt...
6 Jan 2022 by 0x01AA
At a first glance based on your vague input: The Table with users: Users Id, UserThisAndThat The Tables for the messages: Messages Id SendFromUserId SendToUserId Message Query example: SELECT COUNT(*) FROM Messages WHERE...
29 Mar 2022 by Patrice T
You can use nested loops: int X=20; for(int Start=0; Start
29 Mar 2022 by CPallini
Do you really mean int blocks = x / 16; int spare = x % 16; int counter = 0; for (int b=0; b
11 Apr 2022 by Member 15598125
create a step sequencer program. So there should be a note class and a step class. The step class should draw the note class, assigning it its frequency and triOsc. Make a new class Step which will handle a column of Notes. It will have as...
7 May 2022 by kylee mk
********* hi everyone...I solved this problem myself....I put the code below in case anyone might need it...thanks everyone for your help *********** this code should be written with java first a number between 1 and 8 should be received(we...
6 May 2022 by kylee mk
this is the code I've written.....which is totally wrong import java.util.Scanner; public class p { public static void main(String[] args){ Scanner input=new Scanner(System.in); int n=input.nextInt(); String a=new...
16 Sep 2022 by Arya Singh 2021
Write a program to solve a Sudoku puzzle by filling the empty cells where 0 represent empty cell. Rules: All the number in sudoku must appear exactly once in left-top to right-bottom diagonal. All the number in sudoku must appear exactly once...
16 Jul 2023 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
23 Sep 2023 by Patrice T
Quote: trying to figure it out the old fashion way Remember: Google is your friend. Average - Wikipedia[^] Calculating an average is really simple thing. If your are not sure about how to translate in code, experiment/ try things and see the...
23 Sep 2023 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
21 Nov 2023 by CPallini
It is not such a daunting task. Keep track of current charge and check if next leg is reachable without recharging. If it is not, then charge (or give up if you are at the starting point). This is rather naive. But it is a start, anyway. Probably...
14 Feb 2018 by OriginalGriff
Us explaining each and every piece of code you find Can you please explain this pseudo-code to me?[^] isn't goign to help you learn. Read the pseudo code, read the task it is supposed to perform, and work out what it is doing from that - this is pretty obvious stuff, if you have followed your...
22 Mar 2021 by CHill60
We see this sort of thing so often that @originalgriff wrote an article about how to start ... start here How to Write Code to Solve a Problem, A Beginner's Guide[^]
22 Mar 2021 by OriginalGriff
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us...
9 Feb 2023 by Alexey Shtykov
Lot of fancy languages were born and have died since I started working in IT, but a few of them continue their pitiful existance.
15 Apr 2021 by Ananth V
While attending Geeks Classes, Shivani went through a question in which an array was given and she was asked to maximize the sum by picking some elements from the array so that after selecting an element A[i] from array, delete one occurrence of...
23 Sep 2023 by Alaina Robinson
include #include #include #include #include #include #include #include #include #include char* readline(); char* ltrim(char*); char*...
22 Nov 2023 by User-16107551
def num_charging_stops(legs: List[int], capacity: int) -> int: Calculates the number of necessary charging stops to reach the destination. Each "leg" of your journey represents the amount of energy required to drive that leg of the trip. For...
27 Nov 2023 by Member 16149989
I actaully want to make a linear search program in python but i am actually stuck, and the code I develop isn't working well What I have tried: def linear_Search(name,target): for i in range(len(name)): if name[i]==target: ...
12 Dec 2017 by Member 13571185
Contest Page | CodeChef[^] I have used square root decomposition to solve the above question, but I don't understand why am I getting a TLE ? I think there is something additional about online judges or STL that I should have known... What I have tried: #include using namespace...
14 Feb 2018 by tgspython
The Question: Write an algorithm that will find the sum of ten numbers entered by a user and output the result. Use pseudo-code. Include comments to explain how the code works. (6 marks). The Asnwer: SET total TO 0 #The variable 'total is used to store the sum of numbers. FOR goes FROM 1 TO...
23 Jul 2018 by Aman Rawat
0 down vote favorite This question was recently ask in a contest which is now over, but they don't share the editorials with us and this question is stuck in my mind and i am not able to get the answer in optimal way, anybody please explain the proper approach for this is very helpful-:(And if...
22 Aug 2018 by Member 13958388
SOMEONE PLEASE HELP ME SOLVE THIS?!?!?!?! SelectKRandomPointsPurposeSelectKRandomPoints generates a list of k randomly selected pixelsfrom an image. Input(s):It takes twoinputs in the following order: 1)A 3D image array from which to select points from 2)The number of points to randomly...
14 Feb 2021 by Olof Meister
A. BMI Sorting Machine[EN] You are given 𝑁 data where each data consists of ID, name, and heigh in foot and inch. Then, there are 𝑀 queries. For each query, given a variable 𝑥 which represents a height in cm. You are asked for help to display...
8 Jul 2021 by Sarah Semrad
I need to revise my java code for my assignment. For each round, the two players take turns: To make it clear, the human chooses heads or tails, the computer picks randomly.The game loop consists of a player selecting appropriate input (heads or...
21 Aug 2021 by Pirate Gaming 2021
Given the head of a linked list, remove the nth node from the end of the list and return its head. Example 1: Input: head = [1,2,3,4,5], n = 2 Output: [1,2,3,5] What I have tried: Can Someone help me with this problem :)
9 Nov 2021 by asaad asaad
I catch my packets on router using packet sniffer, then I want to use c-code to filter these packets according to port number, IP address ... etc. (Not I want to use only c language). What I have tried: I catch the packets using packet sniffer.