Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. 25 years of programming reduced to a question.

25 years of programming reduced to a question.

Scheduled Pinned Locked Moved The Lounge
questionloungegraphicsgame-devhosting
121 Posts 46 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • OriginalGriffO OriginalGriff

    Well, there is this incredibly inefficient solution:

    int[] data = new int[] { 1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0 };
    int y = 0;
    var result = data.OrderBy(d => d == 0 ? int.MaxValue : y++);

    It works, but ... it's pretty horrible! :laugh:

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #57

    Doing it, "in place":

    List a = new List( new int[] { 1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0 } );

    int count = a.RemoveAll( i => i== 0 );
    a.AddRange( new int[ count ] );

    It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

    J 1 Reply Last reply
    0
    • J Jeremy Falcon

      Does anyone else think coding interviews are fundamentally broken? So like, literally I've been doing this (programming) my whole life. We can all go through our accolades I'm sure, but suffice it to say I've done some things over the years to help rebuild departments in large corporations to garner the attention of regional VPs, etc. as we all have. But, I say this because, two days ago, I had an interview with Unnamed Company That Rhymes With Acelook. Don't get me wrong, they were super friendly, and it was a great chat. But I was asked questions like... Are you comfortable with writing APIs on the backend? That's a generic question, so of course I say sure. To me this indicates the interviewer doesn't realize the best way to interview. No real probing... just questions like that. Ok, cool. Still was a great, super friendly chat. But, then the tech portion of it came up. I was asked this...

      /* given an array of random numbers, push all the zero's of a given array to the end of the array
      for example, if the given arrays is [1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0], it should be changed to [1, 9, 8, 4, 2, 7, 6, 0, 0, 0, 0]

      Example:

      Input: [1, 2, 0, 4, 3, 0, 5, 0];
      Output: [1, 2, 4, 3, 5, 0, 0];

      Input: [1, 2, 0, 0, 0, 3, 6];
      Output: [1, 2, 3, 6, 0, 0, 0]; */

      Ok fine... I get how this game works. So, let's get cracking. The first solution I start with used two arrays. Cool, no biggie. But then the interviewer asked for me to do it in-place. Ok, fine. So, I write some code that is like a bubble sort that brute forced it (ie, nested loops). We all know that it sucks to have nested loops. Anyway, the interview was cut short and that was that. I look up the "official" solution online, and it's no better than my first attempt. In fact, my first attempt was quicker due to only one loop. The one I linked to was using two loops that just weren't nested. So, not only did my original solution avoid two loops (using more memory though), but I found a more elegant solution online and I just know if that interview wasn't cut short I could've tried something like this the third go-round...

      void moveZeroes(vector& nums) {
      for (int lastNonZeroFoundAt = 0, cur = 0; cur < nums.size(); cur++) {
      if (nums[cur] != 0) {
      swap(nums[lastNonZeroFoundAt++], nums[cur]);
      }
      }
      }

      But since I didn't try something like this first, I got passed on. D

      S Offline
      S Offline
      Super Lloyd
      wrote on last edited by
      #58

      Interview I mostly bullshit, I totally agree! Often not done by the people who will work for you but by people who have no clue... with whimsical question either way... It highlights the following truism - being unprepared will guarantee you failure... - being well prepared will leave success to luck... To edge your luck a bit more one got also to work on social skill and self promotion! :p

      A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

      J 1 Reply Last reply
      0
      • R RDM Jr

        Of course it's broken - HR doesn't know anything about the job, so they tend to rely on things like automated scanners that look for the magic keywords in the resume. Then once you've managed to pass through that first filter, the next level of the challenge is getting past the human part of the HR process, where someone who has no idea what you do decides whether or not to pass you on to the actual person/people who needs the job done. Even when you get to that step, there's a fair chance that the manager you talk to doesn't really know what they need, depending on their background and, to some extent, how long it's been since they actually did any coding. And for the high profile darlings of the stock market, as you noted, it's then on to some test totally unrelated to the day-to-day duties you'd actually be performing. It's only when you've passed all of those ridiculous barriers to entry that you might (but only might!) talk to someone who actually knows what the job entails and may be competent to judge whether or not your skills would be a good fit. How else would I wind up as a VB.Net programmer and Excel VBA macro writer when my previous experience was 40+ years of first Fortran and then C in a succession of Unix/Ultrix/Linux environments? And I still tease them about the wisdom of hiring a then 62 year old programmer to replace the 65 year old guy who was retiring!

        M Offline
        M Offline
        Mike Winiberg
        wrote on last edited by
        #59

        Hey, are you my alter ego? 8) I've just thought, maybe old programmers never die, they just become VBA devs... Like you, I started with FORTRAN; then Algol68, Algol60, Pascal, assembler, C, C++, Java, PHP and a few others; now HTML5/CSS/JS, SQL, Python and VBA (Access). By the time I reach 70, will I be reduced to Scratch? HA HA Bonk!

        R M 2 Replies Last reply
        0
        • J Jeremy Falcon

          Does anyone else think coding interviews are fundamentally broken? So like, literally I've been doing this (programming) my whole life. We can all go through our accolades I'm sure, but suffice it to say I've done some things over the years to help rebuild departments in large corporations to garner the attention of regional VPs, etc. as we all have. But, I say this because, two days ago, I had an interview with Unnamed Company That Rhymes With Acelook. Don't get me wrong, they were super friendly, and it was a great chat. But I was asked questions like... Are you comfortable with writing APIs on the backend? That's a generic question, so of course I say sure. To me this indicates the interviewer doesn't realize the best way to interview. No real probing... just questions like that. Ok, cool. Still was a great, super friendly chat. But, then the tech portion of it came up. I was asked this...

          /* given an array of random numbers, push all the zero's of a given array to the end of the array
          for example, if the given arrays is [1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0], it should be changed to [1, 9, 8, 4, 2, 7, 6, 0, 0, 0, 0]

          Example:

          Input: [1, 2, 0, 4, 3, 0, 5, 0];
          Output: [1, 2, 4, 3, 5, 0, 0];

          Input: [1, 2, 0, 0, 0, 3, 6];
          Output: [1, 2, 3, 6, 0, 0, 0]; */

          Ok fine... I get how this game works. So, let's get cracking. The first solution I start with used two arrays. Cool, no biggie. But then the interviewer asked for me to do it in-place. Ok, fine. So, I write some code that is like a bubble sort that brute forced it (ie, nested loops). We all know that it sucks to have nested loops. Anyway, the interview was cut short and that was that. I look up the "official" solution online, and it's no better than my first attempt. In fact, my first attempt was quicker due to only one loop. The one I linked to was using two loops that just weren't nested. So, not only did my original solution avoid two loops (using more memory though), but I found a more elegant solution online and I just know if that interview wasn't cut short I could've tried something like this the third go-round...

          void moveZeroes(vector& nums) {
          for (int lastNonZeroFoundAt = 0, cur = 0; cur < nums.size(); cur++) {
          if (nums[cur] != 0) {
          swap(nums[lastNonZeroFoundAt++], nums[cur]);
          }
          }
          }

          But since I didn't try something like this first, I got passed on. D

          V Offline
          V Offline
          V 0
          wrote on last edited by
          #60

          Unfortunately life is a bit too much about getting the exact right answer, not on how you get there. :sigh: We've all been there. :-\

          V.

          J 1 Reply Last reply
          0
          • J Jeremy Falcon

            And while you're at, can you stop space and time and develop the first programming language used on Mars and feed that back to us? Then on the actual job... your coworker asks you... what's a box model again? How do you configure Webpack? How do I actually do any of the things my job requires? Well, at least I studied algorithms for a few weeks while interviewing. Phew. :rolleyes:

            Jeremy Falcon

            D Offline
            D Offline
            Daniel Pfeffer
            wrote on last edited by
            #61

            Jeremy Falcon wrote:

            And while you're at, can you stop space and time and develop the first programming language used on Mars and feed that back to us?

            Well, we already have the first programming language to be used on Jupiter ([JOVIAL](https://en.wikipedia.org/wiki/JOVIAL)) :-\

            Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

            J 1 Reply Last reply
            0
            • M Mike Winiberg

              Hey, are you my alter ego? 8) I've just thought, maybe old programmers never die, they just become VBA devs... Like you, I started with FORTRAN; then Algol68, Algol60, Pascal, assembler, C, C++, Java, PHP and a few others; now HTML5/CSS/JS, SQL, Python and VBA (Access). By the time I reach 70, will I be reduced to Scratch? HA HA Bonk!

              R Offline
              R Offline
              RDM Jr
              wrote on last edited by
              #62

              It does appear we have a lot of things in common. The first real life project I was on straight out of college I used Cobol on a IV-Phase mini, Fortran, Cobol and Assembler on an Interdata 8/32, and Fortran, Cobol, PL/I, RPG and Assembler on an IBM 370/158 MVS system, and also wound up writing the production JCL. Since then it's been Fortran on a Banyan network, Fortran and C under Ultrix on microVAXen communicating with Fortran on Windows PCs, then C on Xenix, SCO Unix, and finally Linux, to my hopefully final job with VB/Windows using SQL on an Access database, plus a lot of Excel VBA over the last 10 years or so. Now I've started playing around with 3d resin printing, Arduinos and Pi's in my spare time so I won't be too bored in retirement; also taking classes in electronics, microprocessors, etc, at the local community college since I can audit them tuition free now that I'm over 60.

              M 1 Reply Last reply
              0
              • R RDM Jr

                It does appear we have a lot of things in common. The first real life project I was on straight out of college I used Cobol on a IV-Phase mini, Fortran, Cobol and Assembler on an Interdata 8/32, and Fortran, Cobol, PL/I, RPG and Assembler on an IBM 370/158 MVS system, and also wound up writing the production JCL. Since then it's been Fortran on a Banyan network, Fortran and C under Ultrix on microVAXen communicating with Fortran on Windows PCs, then C on Xenix, SCO Unix, and finally Linux, to my hopefully final job with VB/Windows using SQL on an Access database, plus a lot of Excel VBA over the last 10 years or so. Now I've started playing around with 3d resin printing, Arduinos and Pi's in my spare time so I won't be too bored in retirement; also taking classes in electronics, microprocessors, etc, at the local community college since I can audit them tuition free now that I'm over 60.

                M Offline
                M Offline
                Mike Winiberg
                wrote on last edited by
                #63

                I'd forgotten about SCO Xenix/Unix: Believe it or not, the first multi-user reservation system I developed for a shipping/airline operator was written in dBase II running on Xenix with multiplexed Wyse terminals running over AC15 lines between sites. Did a lot if stuff in dBase at one time, it really was revolutionary in the early days of micros. Likewise T/Maker a predecessor to modern day spreadsheets. I may be an old git, but I've grown up with and used many of the significant developments in computing in the last 50 years and it has been an incredible (if not particularly well paid) journey. 8)

                1 Reply Last reply
                0
                • J Jeremy Falcon

                  Does anyone else think coding interviews are fundamentally broken? So like, literally I've been doing this (programming) my whole life. We can all go through our accolades I'm sure, but suffice it to say I've done some things over the years to help rebuild departments in large corporations to garner the attention of regional VPs, etc. as we all have. But, I say this because, two days ago, I had an interview with Unnamed Company That Rhymes With Acelook. Don't get me wrong, they were super friendly, and it was a great chat. But I was asked questions like... Are you comfortable with writing APIs on the backend? That's a generic question, so of course I say sure. To me this indicates the interviewer doesn't realize the best way to interview. No real probing... just questions like that. Ok, cool. Still was a great, super friendly chat. But, then the tech portion of it came up. I was asked this...

                  /* given an array of random numbers, push all the zero's of a given array to the end of the array
                  for example, if the given arrays is [1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0], it should be changed to [1, 9, 8, 4, 2, 7, 6, 0, 0, 0, 0]

                  Example:

                  Input: [1, 2, 0, 4, 3, 0, 5, 0];
                  Output: [1, 2, 4, 3, 5, 0, 0];

                  Input: [1, 2, 0, 0, 0, 3, 6];
                  Output: [1, 2, 3, 6, 0, 0, 0]; */

                  Ok fine... I get how this game works. So, let's get cracking. The first solution I start with used two arrays. Cool, no biggie. But then the interviewer asked for me to do it in-place. Ok, fine. So, I write some code that is like a bubble sort that brute forced it (ie, nested loops). We all know that it sucks to have nested loops. Anyway, the interview was cut short and that was that. I look up the "official" solution online, and it's no better than my first attempt. In fact, my first attempt was quicker due to only one loop. The one I linked to was using two loops that just weren't nested. So, not only did my original solution avoid two loops (using more memory though), but I found a more elegant solution online and I just know if that interview wasn't cut short I could've tried something like this the third go-round...

                  void moveZeroes(vector& nums) {
                  for (int lastNonZeroFoundAt = 0, cur = 0; cur < nums.size(); cur++) {
                  if (nums[cur] != 0) {
                  swap(nums[lastNonZeroFoundAt++], nums[cur]);
                  }
                  }
                  }

                  But since I didn't try something like this first, I got passed on. D

                  M Offline
                  M Offline
                  Member 14174460
                  wrote on last edited by
                  #64

                  Surely the best correct answer is to use std::stable_partition std::stable_partition( v.begin(), v.end(), [](int n){return n != 0;}); Its an excellent question because it shows you know how to use and won't rewrite standard code.

                  1 Reply Last reply
                  0
                  • L Lost User

                    Doing it, "in place":

                    List a = new List( new int[] { 1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0 } );

                    int count = a.RemoveAll( i => i== 0 );
                    a.AddRange( new int[ count ] );

                    It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

                    J Offline
                    J Offline
                    jsc42
                    wrote on last edited by
                    #65

                    This just occurred to me ... JavaScript's Array.sort enables you to use a function to say how sorting is done. All that is needed is a simple function to treat 0 as bigger than non-0.

                    var data = [ 1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0 ];
                    var sorted = data.sort( (a, b) => a == 0 ? 1 : (b == 0 ? -1 : 0) ); // First attempt
                    var sorted = data.sort( (a, b) => a ? (b ? 0 : -1 ) : 1 ); // Exploits 0 == false, non-zero == true
                    alert(sorted);

                    L 1 Reply Last reply
                    0
                    • J Jeremy Falcon

                      Does anyone else think coding interviews are fundamentally broken? So like, literally I've been doing this (programming) my whole life. We can all go through our accolades I'm sure, but suffice it to say I've done some things over the years to help rebuild departments in large corporations to garner the attention of regional VPs, etc. as we all have. But, I say this because, two days ago, I had an interview with Unnamed Company That Rhymes With Acelook. Don't get me wrong, they were super friendly, and it was a great chat. But I was asked questions like... Are you comfortable with writing APIs on the backend? That's a generic question, so of course I say sure. To me this indicates the interviewer doesn't realize the best way to interview. No real probing... just questions like that. Ok, cool. Still was a great, super friendly chat. But, then the tech portion of it came up. I was asked this...

                      /* given an array of random numbers, push all the zero's of a given array to the end of the array
                      for example, if the given arrays is [1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0], it should be changed to [1, 9, 8, 4, 2, 7, 6, 0, 0, 0, 0]

                      Example:

                      Input: [1, 2, 0, 4, 3, 0, 5, 0];
                      Output: [1, 2, 4, 3, 5, 0, 0];

                      Input: [1, 2, 0, 0, 0, 3, 6];
                      Output: [1, 2, 3, 6, 0, 0, 0]; */

                      Ok fine... I get how this game works. So, let's get cracking. The first solution I start with used two arrays. Cool, no biggie. But then the interviewer asked for me to do it in-place. Ok, fine. So, I write some code that is like a bubble sort that brute forced it (ie, nested loops). We all know that it sucks to have nested loops. Anyway, the interview was cut short and that was that. I look up the "official" solution online, and it's no better than my first attempt. In fact, my first attempt was quicker due to only one loop. The one I linked to was using two loops that just weren't nested. So, not only did my original solution avoid two loops (using more memory though), but I found a more elegant solution online and I just know if that interview wasn't cut short I could've tried something like this the third go-round...

                      void moveZeroes(vector& nums) {
                      for (int lastNonZeroFoundAt = 0, cur = 0; cur < nums.size(); cur++) {
                      if (nums[cur] != 0) {
                      swap(nums[lastNonZeroFoundAt++], nums[cur]);
                      }
                      }
                      }

                      But since I didn't try something like this first, I got passed on. D

                      Sander RosselS Offline
                      Sander RosselS Offline
                      Sander Rossel
                      wrote on last edited by
                      #66

                      I once worked for a company where everyone was a developer (except for two people in administration). They had about 30 people. This was from 2014 to about 2017 (just saying, because you may get the idea I'm talking late 90's early 00's). Before I got to work there I got a questionnaire with questions like "what's the next number/figure in the sequence?", "what happens to a candle and a drop of mercury in an elevator that's going down at a certain speed?"(???) something with a sailboat and wind, one question where I had to make a basic HTML page, and two or three database design questions. I skipped the nonsense questions like the sailboat and mercury because I really don't know anything about sailing or friggin' mercury :confused: I somehow made a mistake in the database design, which was unfortunate. Anyway, I got the job and immediately noticed everyone's knowledge was stale. They were working on old languages and frameworks, two teams did EVERYTHING in Oracle (yes, EVERYTHING, if all you have is a hammer...), I got across JavaScript code that returned various types from the same 100+ lines function, despite everyone being an "Oracle expert" (they wrote their own Oracle management tool) I got some very strange looks when I asked about JOIN syntax and tracing, etc. The person who was in charge for keeping up with new technologies only shared the occasional Oracle update (he was in that everything Oracle team). The few good people all quit, save for one who has a family and makes good money there, although he once told me "my career is going backwards here, I'm currently doing Oracle and Delphi." I quit because my team was extremely toxic due to some people being stressed out because they couldn't keep up. I really don't know what their questionnaire was testing, but it wasn't quality in any way.

                      Best, Sander sanderrossel.com Migrating Applications to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                      M J 2 Replies Last reply
                      0
                      • J Jeremy Falcon

                        Does anyone else think coding interviews are fundamentally broken? So like, literally I've been doing this (programming) my whole life. We can all go through our accolades I'm sure, but suffice it to say I've done some things over the years to help rebuild departments in large corporations to garner the attention of regional VPs, etc. as we all have. But, I say this because, two days ago, I had an interview with Unnamed Company That Rhymes With Acelook. Don't get me wrong, they were super friendly, and it was a great chat. But I was asked questions like... Are you comfortable with writing APIs on the backend? That's a generic question, so of course I say sure. To me this indicates the interviewer doesn't realize the best way to interview. No real probing... just questions like that. Ok, cool. Still was a great, super friendly chat. But, then the tech portion of it came up. I was asked this...

                        /* given an array of random numbers, push all the zero's of a given array to the end of the array
                        for example, if the given arrays is [1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0], it should be changed to [1, 9, 8, 4, 2, 7, 6, 0, 0, 0, 0]

                        Example:

                        Input: [1, 2, 0, 4, 3, 0, 5, 0];
                        Output: [1, 2, 4, 3, 5, 0, 0];

                        Input: [1, 2, 0, 0, 0, 3, 6];
                        Output: [1, 2, 3, 6, 0, 0, 0]; */

                        Ok fine... I get how this game works. So, let's get cracking. The first solution I start with used two arrays. Cool, no biggie. But then the interviewer asked for me to do it in-place. Ok, fine. So, I write some code that is like a bubble sort that brute forced it (ie, nested loops). We all know that it sucks to have nested loops. Anyway, the interview was cut short and that was that. I look up the "official" solution online, and it's no better than my first attempt. In fact, my first attempt was quicker due to only one loop. The one I linked to was using two loops that just weren't nested. So, not only did my original solution avoid two loops (using more memory though), but I found a more elegant solution online and I just know if that interview wasn't cut short I could've tried something like this the third go-round...

                        void moveZeroes(vector& nums) {
                        for (int lastNonZeroFoundAt = 0, cur = 0; cur < nums.size(); cur++) {
                        if (nums[cur] != 0) {
                        swap(nums[lastNonZeroFoundAt++], nums[cur]);
                        }
                        }
                        }

                        But since I didn't try something like this first, I got passed on. D

                        M Offline
                        M Offline
                        megaadam
                        wrote on last edited by
                        #67

                        Some programming interviews are bad. Others are good. Let me flip the question on you: How would you interview a candidate?

                        "If we don't change direction, we'll end up where we're going"

                        J 1 Reply Last reply
                        0
                        • Sander RosselS Sander Rossel

                          I once worked for a company where everyone was a developer (except for two people in administration). They had about 30 people. This was from 2014 to about 2017 (just saying, because you may get the idea I'm talking late 90's early 00's). Before I got to work there I got a questionnaire with questions like "what's the next number/figure in the sequence?", "what happens to a candle and a drop of mercury in an elevator that's going down at a certain speed?"(???) something with a sailboat and wind, one question where I had to make a basic HTML page, and two or three database design questions. I skipped the nonsense questions like the sailboat and mercury because I really don't know anything about sailing or friggin' mercury :confused: I somehow made a mistake in the database design, which was unfortunate. Anyway, I got the job and immediately noticed everyone's knowledge was stale. They were working on old languages and frameworks, two teams did EVERYTHING in Oracle (yes, EVERYTHING, if all you have is a hammer...), I got across JavaScript code that returned various types from the same 100+ lines function, despite everyone being an "Oracle expert" (they wrote their own Oracle management tool) I got some very strange looks when I asked about JOIN syntax and tracing, etc. The person who was in charge for keeping up with new technologies only shared the occasional Oracle update (he was in that everything Oracle team). The few good people all quit, save for one who has a family and makes good money there, although he once told me "my career is going backwards here, I'm currently doing Oracle and Delphi." I quit because my team was extremely toxic due to some people being stressed out because they couldn't keep up. I really don't know what their questionnaire was testing, but it wasn't quality in any way.

                          Best, Sander sanderrossel.com Migrating Applications to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                          M Offline
                          M Offline
                          megaadam
                          wrote on last edited by
                          #68

                          Well the interview situation is a pretty good opportunity for you to interview them as well, so...

                          "If we don't change direction, we'll end up where we're going"

                          Sander RosselS 1 Reply Last reply
                          0
                          • J Jeremy Falcon

                            Does anyone else think coding interviews are fundamentally broken? So like, literally I've been doing this (programming) my whole life. We can all go through our accolades I'm sure, but suffice it to say I've done some things over the years to help rebuild departments in large corporations to garner the attention of regional VPs, etc. as we all have. But, I say this because, two days ago, I had an interview with Unnamed Company That Rhymes With Acelook. Don't get me wrong, they were super friendly, and it was a great chat. But I was asked questions like... Are you comfortable with writing APIs on the backend? That's a generic question, so of course I say sure. To me this indicates the interviewer doesn't realize the best way to interview. No real probing... just questions like that. Ok, cool. Still was a great, super friendly chat. But, then the tech portion of it came up. I was asked this...

                            /* given an array of random numbers, push all the zero's of a given array to the end of the array
                            for example, if the given arrays is [1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0], it should be changed to [1, 9, 8, 4, 2, 7, 6, 0, 0, 0, 0]

                            Example:

                            Input: [1, 2, 0, 4, 3, 0, 5, 0];
                            Output: [1, 2, 4, 3, 5, 0, 0];

                            Input: [1, 2, 0, 0, 0, 3, 6];
                            Output: [1, 2, 3, 6, 0, 0, 0]; */

                            Ok fine... I get how this game works. So, let's get cracking. The first solution I start with used two arrays. Cool, no biggie. But then the interviewer asked for me to do it in-place. Ok, fine. So, I write some code that is like a bubble sort that brute forced it (ie, nested loops). We all know that it sucks to have nested loops. Anyway, the interview was cut short and that was that. I look up the "official" solution online, and it's no better than my first attempt. In fact, my first attempt was quicker due to only one loop. The one I linked to was using two loops that just weren't nested. So, not only did my original solution avoid two loops (using more memory though), but I found a more elegant solution online and I just know if that interview wasn't cut short I could've tried something like this the third go-round...

                            void moveZeroes(vector& nums) {
                            for (int lastNonZeroFoundAt = 0, cur = 0; cur < nums.size(); cur++) {
                            if (nums[cur] != 0) {
                            swap(nums[lastNonZeroFoundAt++], nums[cur]);
                            }
                            }
                            }

                            But since I didn't try something like this first, I got passed on. D

                            D Offline
                            D Offline
                            DumpsterJuice
                            wrote on last edited by
                            #69

                            At times in my career I have been in charge of the interviewing. This is how I approached it: GOAL: "Can the person fit in with the group, and contribute". From the resume I glean; 1. I can see a lot of years of experience. (or perhaps "enough" years). 2. I see education. 3. I typically see a list of what the candidate feels is his core skills (they may not be in a technology that we use, because we are using something new) 4. I invite a few dev's to participate, with the only rule being "You cannot use Google to ask questions. (If you have to look it up, that is not fair). 5. The Goal is to get a feel for the candidate as a fellow team member. The Goal is NOT to humiliate, judge, or ask complex algorithms. I do not ask tech questions of a CS Grad, or post Grad. Guess what? They might get it wrong. So what? All this proves is you can ask anybody anything, and they MIGHT get it wrong. If the Candidate is not proficient it will be revealed. (Yes, this may wind up as an exercise in futility) -That's ok. I might even leave him on the team, and adjust to his/her abilities. For example - they be highly skilled in SQL, and less proficient in Angular. You are never going to find "The Golden Candidate". Work Ethic is what I look for. If you can bash your way to learning Angular, that is good enough. You can spend all your time humiliating people, or you can cut to the chase. Keep It Simple, keep it moving.

                            J 1 Reply Last reply
                            0
                            • J Jeremy Falcon

                              Does anyone else think coding interviews are fundamentally broken? So like, literally I've been doing this (programming) my whole life. We can all go through our accolades I'm sure, but suffice it to say I've done some things over the years to help rebuild departments in large corporations to garner the attention of regional VPs, etc. as we all have. But, I say this because, two days ago, I had an interview with Unnamed Company That Rhymes With Acelook. Don't get me wrong, they were super friendly, and it was a great chat. But I was asked questions like... Are you comfortable with writing APIs on the backend? That's a generic question, so of course I say sure. To me this indicates the interviewer doesn't realize the best way to interview. No real probing... just questions like that. Ok, cool. Still was a great, super friendly chat. But, then the tech portion of it came up. I was asked this...

                              /* given an array of random numbers, push all the zero's of a given array to the end of the array
                              for example, if the given arrays is [1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0], it should be changed to [1, 9, 8, 4, 2, 7, 6, 0, 0, 0, 0]

                              Example:

                              Input: [1, 2, 0, 4, 3, 0, 5, 0];
                              Output: [1, 2, 4, 3, 5, 0, 0];

                              Input: [1, 2, 0, 0, 0, 3, 6];
                              Output: [1, 2, 3, 6, 0, 0, 0]; */

                              Ok fine... I get how this game works. So, let's get cracking. The first solution I start with used two arrays. Cool, no biggie. But then the interviewer asked for me to do it in-place. Ok, fine. So, I write some code that is like a bubble sort that brute forced it (ie, nested loops). We all know that it sucks to have nested loops. Anyway, the interview was cut short and that was that. I look up the "official" solution online, and it's no better than my first attempt. In fact, my first attempt was quicker due to only one loop. The one I linked to was using two loops that just weren't nested. So, not only did my original solution avoid two loops (using more memory though), but I found a more elegant solution online and I just know if that interview wasn't cut short I could've tried something like this the third go-round...

                              void moveZeroes(vector& nums) {
                              for (int lastNonZeroFoundAt = 0, cur = 0; cur < nums.size(); cur++) {
                              if (nums[cur] != 0) {
                              swap(nums[lastNonZeroFoundAt++], nums[cur]);
                              }
                              }
                              }

                              But since I didn't try something like this first, I got passed on. D

                              D Offline
                              D Offline
                              dshillito
                              wrote on last edited by
                              #70

                              Are you sure that was the reason you were passed on? Could it be an excuse rather than to say you were too old? Anyway I am glad I never had to undergo any test of programming skill in my entire 45 year career as a programmer. When I did change jobs I was accepted due to my reputation.

                              J 1 Reply Last reply
                              0
                              • S Super Lloyd

                                Interview I mostly bullshit, I totally agree! Often not done by the people who will work for you but by people who have no clue... with whimsical question either way... It highlights the following truism - being unprepared will guarantee you failure... - being well prepared will leave success to luck... To edge your luck a bit more one got also to work on social skill and self promotion! :p

                                A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

                                J Offline
                                J Offline
                                Jeremy Falcon
                                wrote on last edited by
                                #71

                                Super Lloyd wrote:

                                self promotion

                                I think that's the key right there... maybe it's always been this way throughout history. It's certainly true today... if you don't promote yourself nobody cares. Regardless of how good you actually are.

                                Jeremy Falcon

                                1 Reply Last reply
                                0
                                • V V 0

                                  Unfortunately life is a bit too much about getting the exact right answer, not on how you get there. :sigh: We've all been there. :-\

                                  V.

                                  J Offline
                                  J Offline
                                  Jeremy Falcon
                                  wrote on last edited by
                                  #72

                                  Agreed. And overall it was a good experience... still makes you wonder why we put ourselves through that in this industry though.

                                  Jeremy Falcon

                                  1 Reply Last reply
                                  0
                                  • Sander RosselS Sander Rossel

                                    I once worked for a company where everyone was a developer (except for two people in administration). They had about 30 people. This was from 2014 to about 2017 (just saying, because you may get the idea I'm talking late 90's early 00's). Before I got to work there I got a questionnaire with questions like "what's the next number/figure in the sequence?", "what happens to a candle and a drop of mercury in an elevator that's going down at a certain speed?"(???) something with a sailboat and wind, one question where I had to make a basic HTML page, and two or three database design questions. I skipped the nonsense questions like the sailboat and mercury because I really don't know anything about sailing or friggin' mercury :confused: I somehow made a mistake in the database design, which was unfortunate. Anyway, I got the job and immediately noticed everyone's knowledge was stale. They were working on old languages and frameworks, two teams did EVERYTHING in Oracle (yes, EVERYTHING, if all you have is a hammer...), I got across JavaScript code that returned various types from the same 100+ lines function, despite everyone being an "Oracle expert" (they wrote their own Oracle management tool) I got some very strange looks when I asked about JOIN syntax and tracing, etc. The person who was in charge for keeping up with new technologies only shared the occasional Oracle update (he was in that everything Oracle team). The few good people all quit, save for one who has a family and makes good money there, although he once told me "my career is going backwards here, I'm currently doing Oracle and Delphi." I quit because my team was extremely toxic due to some people being stressed out because they couldn't keep up. I really don't know what their questionnaire was testing, but it wasn't quality in any way.

                                    Best, Sander sanderrossel.com Migrating Applications to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                                    J Offline
                                    J Offline
                                    Jeremy Falcon
                                    wrote on last edited by
                                    #73

                                    Sander Rossel wrote:

                                    skipped the nonsense questions like the sailboat and mercury because I really don't know anything about sailing or friggin' mercury

                                    :laugh: :laugh: :laugh: Ouch.

                                    Sander Rossel wrote:

                                    I quit because my team was extremely toxic due to some people being stressed out because they couldn't keep up.

                                    Good move. You'll only end up hating tech that way if you stay in a toxic environment too long. We should be loving our work.

                                    Jeremy Falcon

                                    1 Reply Last reply
                                    0
                                    • M megaadam

                                      Some programming interviews are bad. Others are good. Let me flip the question on you: How would you interview a candidate?

                                      "If we don't change direction, we'll end up where we're going"

                                      J Offline
                                      J Offline
                                      Jeremy Falcon
                                      wrote on last edited by
                                      #74

                                      That's a great question... I eluded to it in another response, but the gist of what I would do is two fold: This interview didn't really probe into my experience at all to get a feel for me. Verbally that is. The interviewer did actually go through my resume (most don't) so props to him. I can't repeat enough that both the recruiter and interviewer were great. I'd also ask more questions about what makes them tick as a person. Algorithms can be taught. Personality can't. Work ethic and drive can't. For the tech side, I'd have basic rudimentary questions to weed out the obvious ones that don't belong (difference between, let and const, etc.), mix them in with tougher ones (what is a weak reference in JS, etc.), and maybe an algo as a bonus. The reason I wouldn't have a one-and-done algorithm question in and of itself, is maybe that person sucks at them, but they are great at design. It's a frontend job, people gonna have difference strengths. But if you one and done based on an algo alone, you'd never know. It's not the whole picture, especially considering algorithms aren't real world 90% of the time. So, I wouldn't base my entire judgment on them. Anyway, not to sound sour over the experience. The folks were great.

                                      Jeremy Falcon

                                      1 Reply Last reply
                                      0
                                      • D Daniel Pfeffer

                                        Jeremy Falcon wrote:

                                        And while you're at, can you stop space and time and develop the first programming language used on Mars and feed that back to us?

                                        Well, we already have the first programming language to be used on Jupiter ([JOVIAL](https://en.wikipedia.org/wiki/JOVIAL)) :-\

                                        Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

                                        J Offline
                                        J Offline
                                        Jeremy Falcon
                                        wrote on last edited by
                                        #75

                                        Touché! :laugh:

                                        Jeremy Falcon

                                        1 Reply Last reply
                                        0
                                        • D DumpsterJuice

                                          At times in my career I have been in charge of the interviewing. This is how I approached it: GOAL: "Can the person fit in with the group, and contribute". From the resume I glean; 1. I can see a lot of years of experience. (or perhaps "enough" years). 2. I see education. 3. I typically see a list of what the candidate feels is his core skills (they may not be in a technology that we use, because we are using something new) 4. I invite a few dev's to participate, with the only rule being "You cannot use Google to ask questions. (If you have to look it up, that is not fair). 5. The Goal is to get a feel for the candidate as a fellow team member. The Goal is NOT to humiliate, judge, or ask complex algorithms. I do not ask tech questions of a CS Grad, or post Grad. Guess what? They might get it wrong. So what? All this proves is you can ask anybody anything, and they MIGHT get it wrong. If the Candidate is not proficient it will be revealed. (Yes, this may wind up as an exercise in futility) -That's ok. I might even leave him on the team, and adjust to his/her abilities. For example - they be highly skilled in SQL, and less proficient in Angular. You are never going to find "The Golden Candidate". Work Ethic is what I look for. If you can bash your way to learning Angular, that is good enough. You can spend all your time humiliating people, or you can cut to the chase. Keep It Simple, keep it moving.

                                          J Offline
                                          J Offline
                                          Jeremy Falcon
                                          wrote on last edited by
                                          #76

                                          Well said. You can always spot the folks here who have actual hiring experience.

                                          DumpsterJuice wrote:

                                          You are never going to find "The Golden Candidate".

                                          It's like a relationship... there's no such thing as perfect. If you think that you're gonna die alone.

                                          DumpsterJuice wrote:

                                          Work Ethic is what I look for. If you can bash your way to learning Angular, that is good enough. You can spend all your time humiliating people, or you can cut to the chase.

                                          Yeah exactly. Especially when most interviewers just Google stuff to ask before the interview anyway. For systems programming I do think algorithms are important actually. But for most LOB jobs... nope. In the past I've aimed for personality, work ethic, and overall competency. We can always Google the algorithms this day and age if we ever get stuck. You can't teach personality.

                                          DumpsterJuice wrote:

                                          Keep It Simple, keep it moving.

                                          Yup. Anyone in this industry long enough knows that devs have the expectation you're not allowed to have a life or family. You're supposed to spend your life 24/7 behind the computer on the off chance someone asks you a question you may not know the answer too. Shudder the thought. It's sad really because those devs rarely learn how to actually work with actual humans.

                                          Jeremy Falcon

                                          D 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups