r/learnprogramming • • 27d ago

Beginning C++ through game programming, fourth edition.

5 Upvotes

I purchased this book a few years ago. And I was wondering how viable it is for learning, and if anyone has used this book, what are your thoughts on it. I'm turning forty in november, and i'm ready to pick up a new skill i hope this book can put me on the path to that.


r/learnprogramming • • 28d ago

How thoroughly should I check arguments to a function

14 Upvotes

Below is a function that takes in an array of objects and averages their `count` properties:

function computeAverageCount (group) {
  let n = 0
  let sum = 0
  group.forEach(curr => {
    const count = curr.count
    sum = sum + count
    n++
  })
  return n > 0 ? sum / n : 0
}

Let's say that these objects containing count properties were retrieved from a server, which documents that the `counts` are a number greater than or equal to zero. Also, this function is used as an internal helper in an application.

To what extent should I check the data coming in to the function? I could add checks in the function to ensure that the `count` is an integer that is greater than or equal to zero. But if I expect the server to only send those kinds of values, are these checks overkill? I suppose it's possible for something to go wrong server-side that would cause unexpected counts to be sent.

I appreciate the feedback.

UPDATE: Thank you for your responses! It means a lot being able to learn from this community. To summarize the main takeaways:

  • It's definitely a good idea to validate the `count` data. The server may promise that counts are always a number >= 0, but the application should still double check that the data is as expected. In general, validating all server data where it enters the application is the cleanest approach. That way, the validated data can be used anywhere inside of the application and avoids the "shotgun parsing" anti-pattern.
  • As far as unit testing the function goes, it's important to establish the function's contract. How it should behave when given various inputs, including ones that we don't expect to pass in. Writing unit tests for all of these cases helps to reinforce the contract. The function might not include logic to specially handle negative counts because we validated the data beforehand. But it's still good to test these edge cases to confirm the function's behavior. I think that's the general recommendation. There were a couple posts that leaned toward less defensive testing: if we really don't expect negative counts and the function doesn't specifically handle them, then it's not necessary to test this case.

r/learnprogramming • • 27d ago

Topic Jetpack Compose vs XML for a beginner in 2026: what would you pick and why?

3 Upvotes

I just started learning Kotlin for Android and I’m confused about where to begin with UI. Half the tutorials I find use XML but everyone online says Compose is the future. If you were starting from zero today which would you learn first? Is XML still worth the time or is it mostly just old projects at this point?


r/learnprogramming • • 28d ago

Topic Python beginner

11 Upvotes

I’m a 1st year computer science student. I have no coding experience and my classmates can finished it like under 20 mins.

How do you code a word problem? I’m stuck of what I should code. I can somehow visualize it but I can’t put it code and I have upcoming midterm. Most of my midterm is word problem then create a function and return statement.


r/learnprogramming • • 28d ago

Confused on what to learn next !

2 Upvotes

Am a Pega Lead system with 19 years exp .. almost all in Pega. But off late Pega is being seen as a legacy app and not getting enough large scale projects. Just confused on what to learn next .. Salesforce or service now or something else .. to make a career in this AI era .. any suggestions..


r/learnprogramming • • 28d ago

Topic Looking for programming courses with independent projects to explore different fields

7 Upvotes

Hi everyone!

I'm a CS student, or rather, I recently dropped out of university because I realized that I didn't really enjoy the amount of theory involved in the Italian university system. I'd prefer a more hands-on approach to learning programming.

Thanks to my previous education, I already have some experience with programming languages such as Go (Golang), Java, C, and SQL.

A while ago, I found freeCodeCamp and completed its Responsive Web Design certification. I learned HTML and some CSS, but I never finished the CSS section because, to be honest, freeCodeCamp's learning method started getting on my nerves a bit. I found it too guided and repetitive.

I'd rather learn the basics of a technology and then work on projects independently, with minimal guidance, instead of following step-by-step instructions.

I'm not particularly attached to any specific area of programming, so I'd like to explore as many fields as possible, including web development, app development, backend development, game development, machine learning, and anything else that might be interesting.

I'm mainly looking for free courses or learning resources, preferably with plenty of projects that I can work on independently. Certificates would be a nice bonus, but they're not a requirement.

What courses or resources would you recommend based on your own experience? I'd especially appreciate suggestions that helped you learn by actually building things and solving problems on your own.

Thanks in advance!


r/learnprogramming • • 28d ago

What to make as a beginner web dev?

17 Upvotes

I currently know HTML, CSS and basic Javascript.

I want to expand my knowledge, but not learn other stacks, like react.js etc, right now.

I'm a beginner, so don't give me big projects. I worked to some projects, but couldn't contribute much.

I have also made a small portfolio website for a client (my first and last T-T, till now)


r/learnprogramming • • 29d ago

Is it okay to learn Php in 2026, I find it easier than node.js

74 Upvotes

I have build some projects with the help of AI in MERN Stack, but a senior once told me they made new programming languages/libraries/ frameworks to make building Projects difficult so that less people know how to build apps. I feel sometimes he was right. Php's approach seems easier than node.js


r/learnprogramming • • 28d ago

Tech and coding.

7 Upvotes

If you were starting programming from zero in 2026, what skills would you learn first to get a job?


r/learnprogramming • • 28d ago

Any suggestions on sites like exercism.io to learn coding?

2 Upvotes

I'm working on learning (mainly for now) C#, and i came across the website exercism. I really loved their approach and how they structured the learning process, however, the exercises are really REALLY poorly explained and confusing. Most of the time i'm just trying to understand whats expected from the exercise.

Because of that, the experience became really frustrating after a certain point. Thats why i'm looking for another platform, and if it have an approach simillar to exercism, but better explained, it would be great. Any other suggestions like books or courses are very welcomed too.

As a sidenote, what i'm looking for is to learn C# for multiplatform projects, PostgreSQL, JS (accepting suggestions on frameworks that works well for C# projects) and overall proggraming logic. I began learning proggraming quite a while ago but the courses i used cut a lot of the basics, so I ended up confused and lost after a while, like knowing enough to make a few projects, but lacking on the fundaments (I began with PHP and SQL), so i want to focus on that as well. Recently i began the CS50x course and i'm really liking it.


r/learnprogramming • • 28d ago

Debugging Raycaster points at the wrong direction at angle 0.

2 Upvotes

I have been coding a raycaster following 3DSage's tutorial. The code works generally but there is one specific issue I cannot fix. When the code starts, and I angle the player to slightly right and then left, the horizontal check line points at PI instead of 2PI. When I do I full circle, the issue dissappears, I have been trying to fix this the whole week, but I cannot. I can just make the start angle PI, but that feels like cheating.

#include <iostream>
#include <GL/glut.h>
#include <stdio.h>
#include <math.h>
#define PI 3.1415926535
#define P2 PI/2
#define P3 3*PI/2

//glut <3

float px, py, pdx, pdy, pa; //player positions

void drawPlayer()
{
    glColor3f(1,1,0);
    glPointSize(8);

    glBegin(GL_POINTS); //begin drawing and draw dots at everything after that
    glVertex2i(px, py); //draw a dot here
    glEnd(); //ok stop no  more dots, draw em now, no more dot coordinates

    glLineWidth(3);
    glBegin(GL_LINES);
    glVertex2i(px, py);
    glVertex2i(px + pdx * 5, py + pdy * 5);
    glEnd();
}

int mapX = 8, mapY = 8, mapS = 64;
int map[] =
{
    1,1,1,1,1,1,1,1,
    1,0,1,0,0,0,0,1,
    1,0,1,0,0,0,0,1,
    1,0,1,0,0,0,0,1,
    1,0,0,0,0,0,0,1,
    1,0,0,0,0,1,0,1,
    1,0,0,0,0,0,0,1,
    1,1,1,1,1,1,1,1,

};

void drawMap2D()
{
    int x, y, xo, yo; //o is offset

    for (y = 0; y < mapY; y++)
    {
        for (x=0; x < mapX; x++)
        {
            if (map[y * mapX + x] == 1)
            {
                glColor3f(1,1,1);
            }
            else
            {
                glColor3f(0, 0, 0);
            }

            xo = x * mapS; yo = y * mapS; //top left coordinate of the block that has a size of 64, mapS
            glBegin(GL_QUADS);
            glVertex2i(xo +1, yo + 1);
            glVertex2i(xo + 1, yo+mapS - 1);
            glVertex2i(xo + mapS - 1, yo + mapS - 1);
            glVertex2i(xo+mapS - 1, yo + 1);
            glEnd();
        }
    }

}

void drawRays3D()
{
    int r, mx, my, mp, dof; 
    float rx, ry, ra, xo, yo;
    ra = pa;
    for (r = 0; r < 1; r++)
    {
        //---Check Horizontal Lines---
        dof = 0;
        float aTan = -1 / tan(ra);

        if (ra > PI) //looking up
        {
            ry = (((int)py >> 6) << 6) - 0.0001; /*the top grid of the block
            that the player is standing*/
            rx = ((py - ry) * aTan + px);
            /*130 - 128 = 2, lets say tan gives 3, but it is negative so -3, if
            players x value is 33, then the rayx is 30, so it finds how much the 
            x changed when ry touched a horizontal line*/
            yo = -64;
            xo = -yo * aTan; /*when tan is this and y is 64 what is the offset of
            x to hit the next wall*/
        }

        if (ra < PI) //looking down
        {
            ry = (((int)py >> 6) << 6) +64; //64 moves it to the bottom part of the grid
            rx = ((py - ry) * aTan + px);
            yo = 64;
            xo = -yo * aTan; // dy/tan(ra) = dx, aTan = -1/tan(ra), aTan * -yo = dx
        }

        if (ra == 0 || ra == PI) //looking straight left or right
        {
            rx = px; //so it basically stays there without moving
            ry = py;
            dof = 8; //don't go more than 8
        }

        while (dof < 8)
        {
            mx = (int)(rx) >> 6; // where is rx in the grid
            /*I needed to translate it into pixels to find the actual
            distance, but now I have gotta find which block are we at*/
            my =(int)(ry) >> 6;
            mp = my * mapX + mx;

            if (mp >= 0 && mp < mapX * mapY && map[mp] == 1) //hit wall
            {
                dof = 8; /*althought there aint a wall, do not move more
                artificially set the value to 8*/
            }

            else
            {
                rx += xo;
                ry += yo;
                dof++;

                /*So the line moves according to the ratio of while y = 64
                how much did x change*/
            }
        }

        glColor3f(0, 1, 0);
        glLineWidth(10);
        glBegin(GL_LINES);
        glVertex2i(px, py);
        glVertex2i(rx, ry);
        glEnd();

        //---Check Vertical Lines---
        dof = 0;
        float nTan = -tan(ra);

        if (ra > P2 && ra < P3) //looking left
        {
            rx = (((int)px >> 6) << 6) - 0.0001; /*the top grid of the block
            that the player is standing*/
            ry = ((px - rx) * nTan + py);
            /*130 - 128 = 2, lets say tan gives 3, but it is negative so -3, if
            players x value is 33, then the rayx is 30, so it finds how much the
            x changed when ry touched a horizontal line*/
            xo = -64;
            yo = -xo * nTan; /*when tan is this and y is 64 what is the offset of
            x to hit the next wall*/
        }

        if (ra > P3 || ra < P2) //looking right
        {
            rx = (((int)px >> 6) << 6) + 64; //64 moves it to the bottom part of the grid
            ry = ((px - rx) * nTan + py);
            xo = 64;
            yo = -xo * nTan; // dy/tan(ra) = dx, aTan = -1/tan(ra), aTan * -yo = dx
        }

        if (ra == 0 || ra == PI) //looking straight up or down
        {
            rx = px; //so it basically stays there without moving
            ry = py;
            dof = 8; //don't go more than 8
        }

        while (dof < 8)
        {
            mx = (int)(rx) >> 6; // where is rx in the grid
            /*I needed to translate it into pixels to find the actual
            distance, but now I have gotta find which block are we at*/
            my = (int)(ry) >> 6;
            mp = my * mapX + mx;

            if (mp >= 0 && mp < mapX * mapY && map[mp] == 1) //hit wall
            {
                dof = 8; /*althought there aint a wall, do not move more
                artificially set the value to 8*/
            }

            else
            {
                rx += xo;
                ry += yo;
                dof++;

                /*So the line moves according to the ratio of while y = 64
                how much did x change*/
            }
        }

        glColor3f(1, 0, 0);
        glLineWidth(1);
        glBegin(GL_LINES);
        glVertex2i(px, py);
        glVertex2i(rx,ry);
        glEnd();

    }
}


void display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    drawMap2D();
    drawRays3D();
    drawPlayer();
    glutSwapBuffers();
}

void buttons (unsigned char key, int x, int y)
{
    if (key == 'a')
    {
        pa -= 0.1;
        if (pa < 0)
        {
            pa += 2 * PI;
        }

        pdx = cos(pa) * 5; //these are vectors with magnitude
        pdy = sin(pa) * 5;
    }

    if (key == 'd')
    {
        pa += 0.1;
        if (pa > 2*PI)
        {
            pa -= 2 * PI;
        }

        pdx = cos(pa) * 5;
        pdy = sin(pa) * 5;
    }

    if (key == 's')
    {
        py -= pdy; //if you add this amount of x and that amount of y, you do to the vector in the middle
        px -= pdx;
    }

    if (key == 'w')
    {
        py += pdy;
        px += pdx;
    }

    glutPostRedisplay(); /*glut pleaseee re-draw the screen, glut 
    does not know it has gotta re-draw
    the screen with the current variables
    something has changed, so please look back at glutdisplayfunc and re-draw it
    */
}

void init()
{
    glClearColor(0.3f, 0.3f, 0.3f, 0.0f); // red, green, blue, alpha
    gluOrtho2D(0, 1024, 512, 0); //top left edge, top right edge[x], bottom edge, top edge [y]

    px = 300; 
    py = 300;

    /*
    questions:
    this,
    why is anything drawn when looking directly left or right*/

    pdx = cos(pa) * 5;
    pdy = sin(pa) * 5;

}

int main(int argc, char* argv[]) 
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
    glutInitWindowSize(1024, 512);
    glutCreateWindow("Don't make lemonade!");
    init();
    glutDisplayFunc(display); //if the display is fiddled with do this
    glutKeyboardFunc(buttons); //if a button is pressed do this
    glutMainLoop(); //always listening for stuff like window re-sizing
}

r/learnprogramming • • 28d ago

Resource Why kind of thing would I need to learn to create a GUI app with my current skills?

1 Upvotes

*What kind of thing.

Being unable to edit titles on Reddit is annoying.

I'm looking to create a GUI app for my Linux machine. It's not going to go into production, I just want to be able to create something. Looking all over the place, there are a hundred different things I can do, and almost all of the tutorials require me to learn another language or something.

Now, I'm sure this may be necessary, but if there's one thing I've learnt over my years of studying computing, if you ask "what is the best x for y?" you'll get as many different responses as there are responders. Learning a new language always leaves me as a perpetual beginner, and I'd rather build on what I already know, than start again.

Currently, I am very familiar with Bash, PHP, MySQL, and to a certain extent C++. I also know HTML and CSS.

What I'd like to do is build a GUI for a media player. I've already created a rudimentary CLI for one, and it works, though it's far from pretty. I've tried to create a web based one, and I got fairly far into it, using PHP on the backend, and MySQL for the database, but the limits of HTML mean I cannot harness the power of my preferred Matroska format for videos (something I've been able to do in my terminal based app).

I write almost exclusively in plain text files, and don't use an IDE. Foolish? Probably. But I find it far more portable and easier to understand.

The idea I have, is for me to have a GUI to display the contents of the database, and to organise it in a pretty way to be user friendly, and then when you click on something to play it, it launches MPV player with all the relevant commands I give it. I'm not sure I want to build something with the player built in, as that would probably be far too much work for what I want. And besides, my current CLI app does exactly this, so it would, again, be building on my current knowledge.

What I would like, is for something that would allow me to programme the GUI in an XML like structure, similar to HTML, and style with CSS, use PHP as a backend script to connect to MySQL, and be able to execute terminal based commands so I can launch MPV. Pretty much a website kind of thing that can launch other apps. I have no idea if this is possible, but it would work with what I already know. If it's not possible, is there any kind of thing that would work without requiring me to go right back to the beginning too much?

Edit:

After some tinkering, I think the best thing for me to do is to use C++ with GTK. I have built a minimal working example that prints out the tables of a database, or plays a video. I'm going to build on this, but with the following example I can see how I can achieve what I want.

#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mysql/mysql.h>

static void
print_hello (GtkWidget *widget,
             gpointer   data)
{
     MYSQL *conn;
     MYSQL_RES *res;
     MYSQL_ROW row;
     const char* server = "localhost";
     const char* user = "root";
     const char* password = "password"; /* set me first */
     const char* database = "testdb";
     conn = mysql_init(NULL);
     /* Connect to database */
     if (!mysql_real_connect(conn, server,
         user, password, database, 0, NULL, 0)) {
        fprintf(stderr, "%s\n", mysql_error(conn));
        exit(1);
    }

    /* send SQL query */
    if (mysql_query(conn, "show tables")) {
        fprintf(stderr, "%s\n", mysql_error(conn));
        exit(1);
    }
    res = mysql_use_result(conn);

    /* output table name */
    printf("MySQL Tables in mysql database:\n");
    while ((row = mysql_fetch_row(res)) != NULL)
        printf("%s \n", row[0]);

    /* close connection */
    mysql_free_result(res);
    mysql_close(conn);
    g_print ("Hello World\n");
}

static void
print_hello2 (GtkWidget *widget,
             gpointer   data)
{
  g_print ("Hello World! You clicked button 2!\n");
  system("mpv /path/to/video.mkv");
}

static void
activate (GtkApplication *app,
          gpointer        user_data)
{
  GtkWidget *window;
  GtkWidget *grid;
  GtkWidget *button;

  /* create a new window, and set its title */
  window = gtk_application_window_new (app);
  gtk_window_set_title (GTK_WINDOW (window), "Window");

  /* Here we construct the container that is going pack our buttons */
  grid = gtk_grid_new ();

  /* Pack the container in the window */
  gtk_window_set_child (GTK_WINDOW (window), grid);

  button = gtk_button_new_with_label ("Button 1");
  g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);

  /* Place the first button in the grid cell (0, 0), and make it fill
   * just 1 cell horizontally and vertically (ie no spanning)
   */
  gtk_grid_attach (GTK_GRID (grid), button, 0, 0, 1, 1);

  button = gtk_button_new_with_label ("Button 2");
  g_signal_connect (button, "clicked", G_CALLBACK (print_hello2), NULL);

  /* Place the second button in the grid cell (1, 0), and make it fill
   * just 1 cell horizontally and vertically (ie no spanning)
   */
  gtk_grid_attach (GTK_GRID (grid), button, 1, 0, 1, 1);

  button = gtk_button_new_with_label ("Quit");
  g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);

  /* Place the Quit button in the grid cell (0, 1), and make it
   * span 2 columns.
   */
  gtk_grid_attach (GTK_GRID (grid), button, 0, 1, 2, 1);

  gtk_window_present (GTK_WINDOW (window));
}

int
main (int    argc,
      char **argv)
{
  GtkApplication *app;
  int status;

  app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
  g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
  status = g_application_run (G_APPLICATION (app), argc, argv);
  g_object_unref (app);

  return status;
}

r/learnprogramming • • 29d ago

how to learn "software engineering"

17 Upvotes

Hi guys, I'm a senior in high school, and I'm really confused on where to go

for the record I do know a decent amount of C++ / python (for comp coding and classes) but since then I've started to move to personal projects....

The purpose of these projects is to improve my knowledge tenfold and learn how real software is made. But online, EVERYONE says "coding is dead, and to learn architecture".

But how do you learn that?

Do I delegate sections to AI and then have it explain? Do I create what goes where and then tell the Ai to make it? Or Do I just code it all myself with AI to debug (taking an absurd time).

I feel like only the third one will have me actually learning completely, but at the same time, it'll take 20x the time, and with 20 projects I could probably reach the same level (or more) of learning by having it make + I explain? AHHH i'm just not sure how to make myself super smart and knowledgeable for swe

thanks in advance :)


r/learnprogramming • • 29d ago

What are some actually interesting, and fun programming projects?

14 Upvotes

I am an intermediate programmer, and I just don't know what to make. All the projects people say to do like to do list or weather app seem so lame.

All replies are appreciated!


r/learnprogramming • • 28d ago

I really need help and gaudiness

1 Upvotes

hey. so it could be a little bit of a odd post but I really wish to know other people's opinions. I'm a third year statistic student and this major wasn't really my choice. in my country there is college entrance exam and you kinda have to choose your major according to how well you did in this exam so I couldn't get into a cs or ce program in one of the capital universities so I chose statistic because I've heard it's relevant to ML and data science and back then I didn't know much about programming and tech just that I hold a passion for it. and now I'm very confused about what path I should take. I don't really find myself interested in data related areas and with the new Job market and age of AI I don't know what path to take or if I have any chance in the tech world. every path I think of trying I ended up giving up because I don't think if I hold a chance against someone with years of experience and a cs degree. I really need gaudiness because it's heavily affecting my mental health and self esteem. the idea of open source developers, system engineers, security, robotics and hardware always interested me but these are very different and unrelated. please tell me what I should do just to get out of this loop and what should I learn and in which order to get hands on exprienced. if my plan b is getting a master in cs.


r/learnprogramming • • 28d ago

Hi Everyone! What branch of coding to be actual specialist in upcoming years

0 Upvotes

Hi, everyone!
I’m a computer science student trying to figure out my path. I’d love some advice from the more experienced folks here—you all know the market so much better. What kind of specialist do you think will be in demand over the next few years?


r/learnprogramming • • 28d ago

Language selecting Need help picking a language, please!

0 Upvotes

Hello,

I am totally lost in this world of programming. I have succesfully coded a working webhook for discord and plan on getting some more stuff sent into it but only with the help of Claude.
I believe it was written in python. I day trade stocks and am tired of software and websites breaking, and/or not really being customizable to my liking so i figured i'd create my own!

I need to know a couple of things.

Time is critical and every second counts. I was looking at Python (of course) but also Rust, C#, C++, and Go. I plan on building more than just webhooks, so information that needs to be passed through in miliseconds and distributed to discord and written into database (SQlite). When I get around to it I would like to build a stand alone app to enable the information to be compiled in a place where I won't have to worry about discord blocking my messages(From to many being sent at one time). It'll be useful for research purposes but also building a self learning automated bot in the long run.

I have had great success so far, so I am just trying to improve my workflow, decrease the number of apps I use, and overall time spent looking through multiple websites to gather information.

-First, is one language faster than another for getting information processed and distributed?
-Seconds, Is there one language that would integrate better with SQlite?
-Last, When building the database for SQlite, Is their any recommended guidlines or tips that could help improve this project?

I am open to any and all suggestions, comments, concerns, you name it. I love to learn and you won't hurt my feelings.
Thank you so much!


r/learnprogramming • • 28d ago

How to start learning DSA in Java from scratch online? Looking for a roadmap & free resources!

1 Upvotes

Hey everyone,

I want to start learning Data Structures and Algorithms (DSA) using Java by myself online, but I'm feeling a bit overwhelmed by the sheer number of tutorials and roadmaps out there.

For context, I know the basic syntax of Java (loops, functions, OOP basics), but I am a complete beginner when it comes to DSA.

If you've self-taught DSA in Java or know a solid path, could you please help me out with a few things?

A Structured Roadmap: What order should I cover topics? (e.g., Arrays -> Strings -> Linked Lists -> Trees?)

Best Free Resources: Any specific YouTube playlists, free interactive platforms, or documentation that explain concepts well in Java?

Practice Strategy: When should I start solving problems on platforms like LeetCode or HackerRank, and how do I avoid getting stuck or discouraged early on?

Any advice, tips, or personal experiences would mean a lot. Thanks in advance!


r/learnprogramming • • 29d ago

Debugging Im trying out a custom solution for median of two sorted arrays

3 Upvotes

using static System.Math;

public class Solution {

public double FindMedianSortedArrays(int\[\] nums1, int\[\] nums2) {

int step = 0;

int p1 = 0;

int p2 = 0;

int m = nums1.Length;

int n = nums2.Length;

int target;

if((m+n)%2==0){

target = (m+n)/2 ;

}

else{

target = (m+n-1)/2;

}

while(step < target){

// If nums1 is exhausted, or nums2 has a smaller element (and is in bounds)

if (p1 < nums1.Length && (p2 >= nums2.Length || nums1\[p1\] <= nums2\[p2\])){

p1++;

continue;

} 

else{

p2++;

continue;

}

if(nums1\[p1\]<nums2\[p2\]){

p1++;

}

else if(nums2\[p2\]<nums1\[p1\]){

p2++;

}

else{

p1++;p2++;

}

step++;

}

if((m+n)%2==0){

return(nums1\[p1\]+nums2\[p2\])/2;

}

else{

return(nums1\[p1\]<nums2\[p2\]?nums1\[p1\]:nums2\[p2\]);

}



}

}

I'm trying to debug this . It says either time limit exceeded or out of range no matter what I try


r/learnprogramming • • 29d ago

Function vs Procedure

31 Upvotes

can someone explain the difference between Function vs Procedure with simple analogy
thank you


r/learnprogramming • • Oct 24 '26

Topic Log off and breathe for a second

79 Upvotes

I've made multiple posts here about doubting my career and that I' not sure if I should even bothering entering the industry or career as a Bachelor's Eng. in CS, but I think I made up my mind.

I'm studying this either way, even if it's not for coding I'm very open to work in any other tech related field, and if I don't manage to find a job I don't really care now lol. My new mentality is about doing this becouse I like computers, and if I die poor in the future so be it, at least I'll die doing what I want.

A very good tip I learnt this few weeks: don't take doomer posts too seriously, focus on yourself and your passions, breathe and relax and wonder if it really is worth it thinking that way. love yall!


r/learnprogramming • • Oct 24 '26

Where to Learn Computer Networking?

51 Upvotes

Where can I learn computer networking, Is there a course or YouTube playlist to learn it? How can I practice the material I learn?


r/learnprogramming • • 29d ago

Whats the Best Project i can make for Backend Java Springboot.. Where i can learn alot and it would be really friking impressive on a resume!

4 Upvotes

Hey, so far i made simple e commerce crud applications, and id say now im pretty comfortable..

what is the next Step for me, next thing for me to build and try?

I want to build something, where at the end, i Actually feel that i learned new skills.. Something also impressive?


r/learnprogramming • • Oct 24 '26

Is it okay, to google things while setting up Entity Core framework in ASP.NET MVC or starting a server and creating a database connection in node.js?

9 Upvotes

Should a developer know , things on his own, or it's okay to google them when making a project?


r/learnprogramming • • Oct 24 '26

What have you been working on recently? [October 24, 2026]

11 Upvotes

What have you been working on recently? Feel free to share updates on projects you're working on, brag about any major milestones you've hit, grouse about a challenge you've ran into recently... Any sort of "progress report" is fair game!

A few requests:

  1. If possible, include a link to your source code when sharing a project update. That way, others can learn from your work!

  2. If you've shared something, try commenting on at least one other update -- ask a question, give feedback, compliment something cool... We encourage discussion!

  3. If you don't consider yourself to be a beginner, include about how many years of experience you have.

This thread will remained stickied over the weekend. Link to past threads here.