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.
  • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

    I think after years you become so focused on real problems and real solutions, that such out-of-the-world questions are irritating you so much you not even feel to do a real effort... You take it as an insult to your developer intelligence :laugh:

    "The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012

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

    I must agree with this sentiment. :thumbsup:

    Jeremy Falcon

    1 Reply Last reply
    0
    • 5 5teveH

      Here's the problem: Most people involved in hiring, (HR and managers), wouldn't recognise talent if the candidate had it tattooed across their forehead. So they resort to 'mechanical' methods of selection. If anywhere needs the help of AI, it's recruitment - because the real stuff isn't in abundance!

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

      This isn't an anti-management or anti-interviewer thing. I've been in management. I've hired people. More developers need to understand the other side of life before casting judgment. Anyway, my recruiter was awesome. The interviewer was great too. Super friendly and knowledgeable. It was a great experience, just broken in the way we go about it.

      Jeremy Falcon

      1 Reply Last reply
      0
      • 5 5teveH

        Here's the problem: Most people involved in hiring, (HR and managers), wouldn't recognise talent if the candidate had it tattooed across their forehead. So they resort to 'mechanical' methods of selection. If anywhere needs the help of AI, it's recruitment - because the real stuff isn't in abundance!

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

        Btw, I do agree that a lot of recruiters and HR only go for the buzzword bingo game... but in this instance the recruiter was fantastic.

        Jeremy Falcon

        1 Reply Last reply
        0
        • J jsc42

          I had a similar experience: take a text and embed it in a string with a '*' at char 1 (counting from 1) and a '*' in char 14 with the text in the middle padded (if necessary) with spaces using a language whose only string function was LENGTH. I wrote a one line solution that took a max of 4 comparisons and was told it was wrong. Why? It did not match the question setters solution (which was 12 lines and always used 12 comparisons). As the interviewer said to me "There are two solutions: my way [i.e. his way] and the wrong way".

          J Offline
          J Offline
          Johnny J
          wrote on last edited by
          #25

          Oh yeah. Everybody who has more than 25 years in programming knows that there is only ONE SOLUTION to every given problem. That's why our job is so easy. We just look up the right solution in our programmers handbook and off we go.... Sarcastic? Who, me? Nooooooooo! :doh:

          Anything that is unrelated to elephants is irrelephant
          Anonymous
          -----
          The problem with quotes on the internet is that you can never tell if they're genuine
          Winston Churchill, 1944
          -----
          Never argue with a fool. Onlookers may not be able to tell the difference.
          Mark Twain

          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
            Sandeep Mewara
            wrote on last edited by
            #26

            Jeremy Falcon wrote:

            Anyone else agree this is fundamentally broken?

            Yes. For experienced folks, just a problem solving should not be the one to decide. It could also be an off day not just unable to answer exactly as the interviewer is expecting.

            Latest CodeProject post: Data Visualization - Insights with Matplotlib To read all my blog posts, visit: Learn by Insight...

            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

              F Offline
              F Offline
              F ES Sitecore
              wrote on last edited by
              #27

              To be fair, putting arbitrary things at the bottom of the pile is a pretty important task for companies these days so it's no wonder they want to know you're good at it.

              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

                M Offline
                M Offline
                Marc Clifton
                wrote on last edited by
                #28

                Jeremy Falcon wrote:

                Anyone else agree this is fundamentally broken?

                Yes. The answer that I gave some folks a couple years ago was "Please don't ask me questions I can google the answer for." There was a few seconds of silence. The question they asked me was something along the lines of "what's an abstract class?" Seriously? I've been programming for 40+ years and you ask me that??? Marc

                Latest Articles:
                Thread Safe Quantized Temporal Frame Ring Buffer

                J P M 3 Replies Last reply
                0
                • F F ES Sitecore

                  To be fair, putting arbitrary things at the bottom of the pile is a pretty important task for companies these days so it's no wonder they want to know you're good at it.

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

                  True... I could see that for sorting say notifications on the frontend, but 9 times out of 10 you'd use a method like Array.protoype.sort() rather than roll your own. Point being, for most LOB applications... we don't have to re-invent the wheel.

                  Jeremy Falcon

                  J 1 Reply Last reply
                  0
                  • M Marc Clifton

                    Jeremy Falcon wrote:

                    Anyone else agree this is fundamentally broken?

                    Yes. The answer that I gave some folks a couple years ago was "Please don't ask me questions I can google the answer for." There was a few seconds of silence. The question they asked me was something along the lines of "what's an abstract class?" Seriously? I've been programming for 40+ years and you ask me that??? Marc

                    Latest Articles:
                    Thread Safe Quantized Temporal Frame Ring Buffer

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

                    Marc Clifton wrote:

                    The question they asked me was something along the lines of "what's an abstract class?" Seriously? I've been programming for 40+ years and you ask me that???

                    Ha ha ha ha ha ha. I laugh because I know developers who have asked a question like that way more than once. Interviewing is a bit of a skill unfortunately. It's not something that just naturally comes to people simply because they learn to program. Granted, it's important you are technical in one IMO, but you gotta learn the soft skills too.

                    Jeremy Falcon

                    1 Reply Last reply
                    0
                    • R rnbergren

                      yep, I was once asked a question of if you can only have two variables how do you switch their values. I was in a peevy mood(due to idiot I was interviewing with) and didn't really think before I answered. But I essentially said never happens in real life and why the heck do you want too and dude it really isn't possible. Once I thought about it for a second(a week later) I understood it was just a theoretical question. But hell. a = 15 b = 5 a= a+b b = a-b a = a-b But would that ever happen in a real life work environment?

                      To err is human to really mess up you need a computer

                      F Offline
                      F Offline
                      Fueled By Decaff
                      wrote on last edited by
                      #31

                      There is an old trick from days when memory sizes were counted in bytes. (No I did not figure it out and had to be taught it.) Use three exclusive or operations. This will avoid the overflow issue of using add and subtract. For example:

                      a = 15
                      b = 5
                      a = a^b
                      b = b^a
                      a = a^b

                      J J 2 Replies Last reply
                      0
                      • M Marc Clifton

                        Jeremy Falcon wrote:

                        Anyone else agree this is fundamentally broken?

                        Yes. The answer that I gave some folks a couple years ago was "Please don't ask me questions I can google the answer for." There was a few seconds of silence. The question they asked me was something along the lines of "what's an abstract class?" Seriously? I've been programming for 40+ years and you ask me that??? Marc

                        Latest Articles:
                        Thread Safe Quantized Temporal Frame Ring Buffer

                        P Offline
                        P Offline
                        peterkmx
                        wrote on last edited by
                        #32

                        Quote:

                        Please don't ask me questions I can google the answer for

                        :-) great line idd ...

                        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

                          P Offline
                          P Offline
                          peterkmx
                          wrote on last edited by
                          #33

                          Suddenly I think about "ICT-competences modelling" as a few years ago I participated in a research project on higher ICT education. Indeed I think that most HR "still" do not pay attention to relevant aspects of a "programmer"-profile such as communication capabilities, team skills, problem solving, organizing the work, etc ...

                          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

                            F Offline
                            F Offline
                            Fueled By Decaff
                            wrote on last edited by
                            #34

                            It is annoying when faced with something like this, but it is surprisingly common. In my opinion a programming test should be short, simple and should only be possible to be failed by someone who can not program - ideally you should be able to use it as a springboard for discussing programming techniques. A lot of people are not good at on the spot tests like this, so this type of interview gets a lot of false negatives. I guess Acelook can pass over good candidates, because they have a lot of candidates to choose from. Perhaps they use custom algorithms and need every programmer to be able to create them. One slight point though - your single loop solution will typically be slightly less efficient then the two loop solution, although it does seem clearer what your solution is doing. Addendum: So when does OG start at Acelook? :laugh:

                            J 1 Reply Last reply
                            0
                            • J Jeremy Falcon

                              Right... that's the first take, but I used two arrays to pull it off to avoid the second loop.

                              Jeremy Falcon

                              R Offline
                              R Offline
                              raddevus
                              wrote on last edited by
                              #35

                              Seriously, I was thinking about this and there is a cheat to the original instructions. At least in JavaScript. See they just said put all the zeroes at the end. Well. you can do that in one for loop... Each time through loop 1. splice off the 0 at its original location. 2. then push it onto the end Voila!

                              var data = [ 1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0 ];

                              for (var x = 0;x

                              J D M 3 Replies Last reply
                              0
                              • M Marc Clifton

                                Jeremy Falcon wrote:

                                Anyone else agree this is fundamentally broken?

                                Yes. The answer that I gave some folks a couple years ago was "Please don't ask me questions I can google the answer for." There was a few seconds of silence. The question they asked me was something along the lines of "what's an abstract class?" Seriously? I've been programming for 40+ years and you ask me that??? Marc

                                Latest Articles:
                                Thread Safe Quantized Temporal Frame Ring Buffer

                                M Offline
                                M Offline
                                musefan
                                wrote on last edited by
                                #36

                                Marc Clifton wrote:

                                "what's an abstract class?"

                                A lesson where you learn to paint like Mondrian?

                                1 Reply Last reply
                                0
                                • OriginalGriffO OriginalGriff

                                  A few moments though gave me this:

                                  int[] data = new int[] { 1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0 };
                                  int outp = 0;
                                  for (int inp = 0; inp < data.Length; inp++)
                                  {
                                  int d = data[inp];
                                  if (d != 0)
                                  {
                                  data[outp++] = d;
                                  }
                                  }
                                  while (outp < data.Length)
                                  {
                                  data[outp++] = 0;
                                  }

                                  "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!

                                  R Offline
                                  R Offline
                                  raddevus
                                  wrote on last edited by
                                  #37

                                  Look at this stupid C# code I wrote that allows you to do only one for loop.

                                  //int [] data = {1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0};
                                  //int [] data = {0,0,0,0};
                                  //int [] data = {0,1,2,0,0,0,0,0};
                                  int [] data = {0,1,2,0,0,0,0,0,5};
                                  List allData = new List(data);
                                  var originalSize = allData.Count;
                                  var counter=0;
                                  for (int x =0;counter<=originalSize;x++){
                                  if (allData[x]== 0){
                                  Console.WriteLine($"got 0 : {x}");
                                  allData.RemoveAt(x--);
                                  allData.Add(0);
                                  }
                                  counter++;
                                  }
                                  data = allData.ToArray();
                                  Console.WriteLine(data);

                                  I've provided multiple data sets to test the data. It works. :rolleyes: EDIT i was trying to reproduce what I could do in JavaScript. See above... The Lounge[^]

                                  OriginalGriffO 1 Reply Last reply
                                  0
                                  • R raddevus

                                    Seriously, I was thinking about this and there is a cheat to the original instructions. At least in JavaScript. See they just said put all the zeroes at the end. Well. you can do that in one for loop... Each time through loop 1. splice off the 0 at its original location. 2. then push it onto the end Voila!

                                    var data = [ 1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0 ];

                                    for (var x = 0;x

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

                                    That's a good solution and better than my first one that used two arrays. Too bad I didn't think of it two days ago. :sigh:

                                    Jeremy Falcon

                                    1 Reply Last reply
                                    0
                                    • F Fueled By Decaff

                                      It is annoying when faced with something like this, but it is surprisingly common. In my opinion a programming test should be short, simple and should only be possible to be failed by someone who can not program - ideally you should be able to use it as a springboard for discussing programming techniques. A lot of people are not good at on the spot tests like this, so this type of interview gets a lot of false negatives. I guess Acelook can pass over good candidates, because they have a lot of candidates to choose from. Perhaps they use custom algorithms and need every programmer to be able to create them. One slight point though - your single loop solution will typically be slightly less efficient then the two loop solution, although it does seem clearer what your solution is doing. Addendum: So when does OG start at Acelook? :laugh:

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

                                      Fueled By Caffeine wrote:

                                      A lot of people are not good at on the spot tests like this, so this type of interview gets a lot of false negatives.

                                      Yeah that's exactly right. It takes time to analyze a problem you haven't run across before. When the interview is cut short... time is not on your side. It's so much easier to spend time working on it when nobody is watching. It's almost to be a developer you have to study algorithms you'll never use and study what you'll actually be doing. Twice the effort for half the gain.

                                      Fueled By Caffeine wrote:

                                      One slight point though - your single loop solution will typically be slightly less efficient then the two loop solution, although it does seem clearer what your solution is doing.

                                      Oh I agree. The further up the loop you go in the second solution the quicker it becomes, but still... hard to work against the clock like that for something new. Such is life I guess. Bubble type sorts are slow, but at least they are tried and true... which is why I went that route for the second solution. Given enough time... I'd like to think I could've done better. Guess, I'll have to brush up on stuff I'll never use once I get the job.

                                      Fueled By Caffeine wrote:

                                      Addendum: So when does OG start at Acelook?

                                      Dunno... hopefully he'll get me in the door too. :laugh:

                                      Jeremy Falcon

                                      D 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!

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

                                        RDM Jr wrote:

                                        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!

                                        Well, if they didn't hire people your age, they could be accused of age discrimination.

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

                                        1 Reply Last reply
                                        0
                                        • R raddevus

                                          Seriously, I was thinking about this and there is a cheat to the original instructions. At least in JavaScript. See they just said put all the zeroes at the end. Well. you can do that in one for loop... Each time through loop 1. splice off the 0 at its original location. 2. then push it onto the end Voila!

                                          var data = [ 1, 9, 8, 4, 0, 0, 2, 7, 0, 6, 0 ];

                                          for (var x = 0;x

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

                                          But internally, the splice() operation is performing an O(N) operation - moving all elements down by one position. Your solution is therefore O(N^2). If I were the interviewer, I would ask if you can see a problem with this solution, and then ask you for a more efficient (O(N)) solution.

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

                                          R J 2 Replies 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