r/programmingchallenges • • Feb 07 '20

This one Bracket is driving me insane how to i fix this? it says "Expected a Declaration" #challenges #programming #code #C++ #visualstudio

Post image
0 Upvotes

r/programmingchallenges • • Aug 17 '19

Very few developers can implement this recursive function

0 Upvotes

It still amazes me that many professional developers have difficulties to create a simple recursive JavaScript function. The following simple question appeared in many hiring interviews and few were able to solve it.

Let’s say we have an array containing numbers and / or other arrays of numbers. Example:

var ar = [2, 4, 10, [12, 4, [100, 99], 4], [3, 2, 99], 0]; 

We need to create a function to find the maximum number in this array.

This problem has actually 2 solutions. One recursive and one iterative. The recursive one is the most elegant and easy to understand.

Solution 1: Recursive approach. findMax1(ar) is the function that returns the maximum number in this kind of array.

var ar = [2, 4, 10, [12, 4, [100, 99], 4], [3, 2, 99], 0];

var m1 = findMax1(ar);
println("Max 1 = ", m1);

// Use recursion to find the maximum numeric value in an array of arrays
function findMax1(ar)
{
    var max = -Infinity;

    // Cycle through all the elements of the array
    for(var i = 0; i < ar.length; i++)
    {
        var el = ar[i];

        // If an element is of type array then invoke the same function
        // to find out the maximum element of that subarray
        if ( Array.isArray(el) )
        {
            el = findMax1( el );
        }

        if ( el > max )
        {
            max = el;
        }
    }

    return max;
}

Solution 2: Iterative approach. If you are an advanced programmer… please try to solve this without recursion. The problem has also a classic iterative solution. I won’t present the second solution here, but if you are interested to see it please open the “Find Max” tutorial from https://codeguppy.com


r/programmingchallenges • • Oct 24 '19

Can anyone translate this into english? Ching is 0, Chong is 1. Ill follow anyone who dm's me it. (The text is in the document)

Thumbnail
docs.google.com
0 Upvotes

r/programmingchallenges • • Feb 11 '16

Desperately need assistance in node.js, gulp, laravel

0 Upvotes

First off, I apologize if I'm in the incorrect subreddit.

I have a developer who left me hanging with a ton of code that I don't know how to navigate. I'm a basic frontend developer and am having some trouble with setup to preview what work has been done thus far.

Here's the setup:

backend

  1. PHP > 5.4

  2. Laravel

  3. Mysql

  4. Composer for vendor code management

frontend (angular single page application) AngularJS node.js npm gulp

So far, I've:

Installed MAMP, MySQL, Composer, Laravel, Node.JS, NPM, and Gulp (with a few errors). I understand the basics of Laravel and using /public to preview my site via MAMP's localhost.

Unfortunately, in this developer's file structure, there's no /public folder. I'm assuming that's because he used gulp to create builds. So I set MAMP to /build and the screen is just white. I just want to double-check the work that was completed. Any help is appreciated! Thanks!


r/programmingchallenges • • Feb 08 '18

I need help with this C# Visual Studios Project (Windows Forms)

0 Upvotes

Hello reddit.

Can anyone help me with this Programming scenario. I’m perplexed and do not know how to start it let alone code it. Can anyone help me out? The scenario is below. If you could help me I would be so greatly appreciative!

You have been employed as a junior programmer for the company Weston Inc. Your management are interested in moving away from using console based programming solutions as they are losing out on business as companies are looking for graphical event driven solutions.

Your management has decided to give you the task of designing one of the new applications that will be created for one of their customers; Westfield Bank.

“Westfield Bank offers a foreign exchange service; this means that customers can exchange their money for foreign currency such as Euros or US Dollars. Each currency has a different exchange rate, for example, if exchange rate for British pounds to US dollars about 1.6, for £10 you would get $16 (not including commission charge). At the present time the cashiers look up the appropriate exchange rate in printed tables and work out the correct amount of currency using a calculator; manually taking off the commission charge.

“Westfield Bank want to provide its cashiers with an automated currency converter programme that will calculate the correct amount of currency that they should give to a customer.

The initial user requirements for the currency converter at Westfield Bank are as follows:-

• The program should display a list of currencies to convert to, allow the user to enter the amount to convert and then display the amount of currency that should be given to the customer after the exchange.

• The program should display the conversion rate that has been used.

• The program should subtract commission at a rate of 2% from the GBP amount converted from/to.

• The amount of commission charged should be displayed.

• The program should allow conversion from GBP to at least 3 foreign currencies, and 3 foreign currencies back to GBP.

• The programme should save a log of every transaction for audit purposes detailing appropriate information to allow each transaction to be identified.

• The program should not allow users to exchange between two foreign currencies.

• The program should be able to be reset quickly for another transaction and have a help button for the user if they are unsure on how to use it.

• The programme should have appropriate built-in validation to try to minimise human error inputs to the program.


r/programmingchallenges • • Aug 29 '18

Program that detects fan speed and cuts CPU usage accordingly

1 Upvotes

Hi there, I know very little about programming, but I have recently been using the Folding@Home browser to solve folding problems and would like someone's input on this. Solving the problems causes CPU usage to go up, which causes the fan speed to increase, which is noisy and annoying. Can I challenge someone to write a program that would cut CPU usage when the fan speed increases above a certain level, so the fan speed falls back down again? Basically have the CPU solving problems at a level as fast as it can without increasing fan speed. I would be able to run FAH all the time then. Thank you.


r/programmingchallenges • • May 16 '19

I don't know who'd call this a challenge, but I'm going to study Java, PHP, C#, and Javascript at the same time.

Thumbnail
agentanakinai.wordpress.com
0 Upvotes

r/programmingchallenges • • Aug 10 '16

My AS400 is too old for new drivers and my printer doesn't work with the latest drivers I can use. Can I code an artificial patch that would "patch" the driver so its compatible?

0 Upvotes

This question is actually for my dad. He uses a dinosaur AS400 system and recently his printer stopped working because the latest patch my dad can download is too old to be supported anymore by the printer.

Ideally, I'd like to write a bit of code that could mock up the latest driver in a way that makes the printer think that the driver is compatible. I'm really hoping to not have to spend any money on buying a new device and I'm working on solutions for my problem.

Any tips, advice, or recommendations would be greatly appreciated.


r/programmingchallenges • • Jul 04 '18

Web scraping

0 Upvotes

Does anyone know how to build a mobile app that scrapes all the headlines from a newspaper website?


r/programmingchallenges • • Oct 26 '19

Interesting Coding problems

1 Upvotes

Hey guys, this is our group's first blog containing a couple of competitive questions. I'm sure it will be interesting. Make sure to check it out, and leave your claps.

https://medium.com/@harikumar20112000/cracking-the-code-ca398240a03d

P.S. Our professor has assured us that we would get movie tickets if we get claps from more than 150 people. So please help us win guys! 😁


r/programmingchallenges • • Dec 30 '18

Final Programming Project

0 Upvotes

{Hello guys,

I am in a beginner coding class in my sophomore year of high school. For my midterms I have to create a project that shows what I have learned so far. Im using processing as the engine and I dont really know what to do. Help would be appreciated! :D

}


r/programmingchallenges • • Feb 22 '17

[Challenge] Could someone create a script that notifies the user when tickets are restocked?

0 Upvotes

Basically the title, but I was curious if it would be possible to have this so that I'd know when concert tickets opened up.


r/programmingchallenges • • Nov 30 '16

If I'm about to start on using a programming language what should I learn first?

0 Upvotes

If your about to start learning a programming language, say Java. What would you recommend learning before starting on this.


r/programmingchallenges • • Nov 10 '11

Challenge create a method for alphabetizing an array of strings

0 Upvotes

r/programmingchallenges • • Sep 05 '24

Help needed with Reflection Problem. Urgent, please help 😭😭

0 Upvotes

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


r/programmingchallenges • • Aug 22 '13

Why US College Teams Can't Win the ACM Programming Contest

Thumbnail
studyhelpfox.com
0 Upvotes

r/programmingchallenges • • Jan 16 '17

Unique protection device guid

0 Upvotes

So I have a DVD with software on it. Software can be installed / run in 2 ways (as I found):

1.Using original DVD 2.Mounting as IDE or SCSI Otherwise when I run installation it checks if the DVD is legal and then I get an error like "counterfeit or copy"...

BUT... I have found out, that in DVD there is file disc.id in which there is line with device-guid which is unique (can not be find in google). As I guess this guid is unique because it is the code of the DVD itself.

I have also found that there is file Setup-1a.bin in folder next to third parties, which design of the code is very similar to the code of .sys drivers of the dvd drive (but not the same).

I am not a programmer, but I know how to use google :)

Anyway, I have various experience, but now for the first time here on reddit I make a comment, because I need help, I need smart minds...

So my questions are: 1.Can I change device's guid? for example blank DVD's guid or USB stick guid? 2.How can I remove or "walk over" such protection? I want to copy DVD and keep it as backup.


r/programmingchallenges • • Aug 21 '19

Android Gif app from some tutorials im testing out

0 Upvotes

r/programmingchallenges • • Sep 16 '18

I'm I a programmer or a fraud who steals code from other sources?

2 Upvotes

I can read and understand code but I am not able to write code from scratch without going to other sources. I was able to make several dynamic websites mainly by getting the code from other sources and then I would modify that code in order to make it fit into my project.

Maybe I'm suffering from the impostor syndrome or maybe I'm just a fraud who pretends that he can program.

If I have to be honest most of my code is extracted from other sources such as Google searches, YouTube videos, w3school website and the only time that I am really coding is when I am modifying the code to make it fit into my project.

Is this method of copying and modifying code acceptable in the workplace or do they require that all code is written from scratch?

I am at the state where I can read, understand and modify the code to meet my functional requirements for my project but I cannot write the code from scratch without using external sources will this change over time after acquiring years of professional work experiences or will I always stay at this level?

I enjoy programming and creating projects but I just feel like a fraud because I am not able to write code from scratch without using external sources.

For example, If you told me to create a hotel reservation system without using Google or other external sources then I would not be able to make it. Does this mean that I am not a real programmer and just a fraud?

I would really appreciate if someone could give me advice on what to do and how to overcome this dilemma of self-doubt.

I hoped of getting a PHP developer job but because of this self-doubt, I am thinking to quit learning programming and just stay in my current job.


r/programmingchallenges • • Sep 30 '17

Create a hacking Usb

Thumbnail
youtu.be
2 Upvotes

r/programmingchallenges • • Oct 31 '16

In batch when your making a program how do you hide the source code?

1 Upvotes

So when your using batch (Cmd, Notepad,etc) after you've made the program. Say you wanted to give a batch file to a friend how do you hide the code used to make it?

And I'm not talking about @echo off I mean when they(the person I give it to) get the code simply changing it to a text file won't give them the code.


r/programmingchallenges • • Apr 09 '13

Nice and easy challenge

1 Upvotes

http://jobs.p1.com/tech/different.html Would love to hear some very efficient solutions


r/programmingchallenges • • Aug 25 '18

PUBG Xbox Radar

0 Upvotes

Anyone willing to make a private (personal) radar for me? Like Nitrospy.


r/programmingchallenges • • Jan 05 '12

Excel Rows and Columns Hiding with VBA

Thumbnail
channel9.msdn.com
1 Upvotes

r/programmingchallenges • • Jun 15 '18

Can you de-encrypt an enceyption from a 16 year old?

0 Upvotes

Thought I would share what I have been working on here on reddit, for anyone looking for a hard encryption challenge I think you found the right post.

The encryption has 4 keys needed to unlock it:

Encryption Keys: {34, 88, 76, 78}

These 4 keys can be used to de-encrypt this message:

301342y|j"qO267750re.HMp265166(mnr+265166hHbL+.278086uY#^\q306510K:l>|R89454Stz$?161806Ar*X}+138550()?=Gz

First person to send me the de-encrypted message, will get $25 as a reward <3.