Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39310 > unrolled thread

Writing Java code while drunk and stoned take 2

Started bychad altenburg <cdalten@gmail.com>
First post2020-02-27 06:00 -0800
Last post2020-03-06 05:52 -0800
Articles 7 on this page of 27 — 7 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Writing Java code while drunk and stoned take 2 chad altenburg <cdalten@gmail.com> - 2020-02-27 06:00 -0800
    Re: Writing Java code while drunk and stoned take 2 nobody@example.org (Scott) - 2020-02-27 16:39 +0000
    Re: Writing Java code while drunk and stoned take 2 Eric Douglas <e.d.programmer@gmail.com> - 2020-02-27 09:05 -0800
    Re: Writing Java code while drunk and stoned take 2 Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2020-02-27 19:04 +0100
      Re: Writing Java code while drunk and stoned take 2 Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2020-02-27 19:05 +0100
      Re: Writing Java code while drunk and stoned take 2 Eric Douglas <e.d.programmer@gmail.com> - 2020-02-27 10:25 -0800
    Re: Writing Java code while drunk and stoned take 2 Arne Vajhøj <arne@vajhoej.dk> - 2020-02-27 18:41 -0500
      Re: Writing Java code while drunk and stoned take 2 Joerg Meier <joergmmeier@arcor.de> - 2020-03-01 22:50 +0100
        Re: Writing Java code while drunk and stoned take 2 Arne Vajhøj <arne@vajhoej.dk> - 2020-03-01 19:53 -0500
          Re: Writing Java code while drunk and stoned take 2 chad altenburg <cdalten@gmail.com> - 2020-03-03 04:54 -0800
            Re: Writing Java code while drunk and stoned take 2 Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2020-03-03 14:20 +0100
            Re: Writing Java code while drunk and stoned take 2 Joerg Meier <joergmmeier@arcor.de> - 2020-03-03 15:00 +0100
              Re: Writing Java code while drunk and stoned take 2 Eric Douglas <e.d.programmer@gmail.com> - 2020-03-03 08:19 -0800
                Re: Writing Java code while drunk and stoned take 2 chad altenburg <cdalten@gmail.com> - 2020-03-04 05:53 -0800
                  Re: Writing Java code while drunk and stoned take 2 Eric Douglas <e.d.programmer@gmail.com> - 2020-03-04 09:59 -0800
                    Re: Writing Java code while drunk and stoned take 2 chad altenburg <cdalten@gmail.com> - 2020-03-05 05:53 -0800
                      Re: Writing Java code while drunk and stoned take 2 Eric Douglas <e.d.programmer@gmail.com> - 2020-03-05 09:29 -0800
                        Re: Writing Java code while drunk and stoned take 2 "C.D. Altenburg, Ph.D," <cdalten@gmail.com> - 2020-03-06 05:49 -0800
                          Re: Writing Java code while drunk and stoned take 2 Eric Douglas <e.d.programmer@gmail.com> - 2020-03-06 07:00 -0800
                            Re: Writing Java code while drunk and stoned take 2 "C.D. Altenburg, Ph.D," <cdalten@gmail.com> - 2020-03-07 05:40 -0800
                          Re: Writing Java code while drunk and stoned take 2 Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2020-03-06 17:47 +0100
                            Re: Writing Java code while drunk and stoned take 2 "C.D. Altenburg, Ph.D," <cdalten@gmail.com> - 2020-03-07 05:42 -0800
                          Re: Writing Java code while drunk and stoned take 2 Eric Douglas <e.d.programmer@gmail.com> - 2020-03-06 09:03 -0800
                    Re: Writing Java code while drunk and stoned take 2 chad altenburg <cdalten@gmail.com> - 2020-03-05 07:22 -0800
                      Re: Writing Java code while drunk and stoned take 2 Eric Douglas <e.d.programmer@gmail.com> - 2020-03-05 07:48 -0800
                        Re: Writing Java code while drunk and stoned take 2 "C.D. Altenburg, Ph.D," <cdalten@gmail.com> - 2020-03-06 05:50 -0800
                        Re: Writing Java code while drunk and stoned take 2 "C.D. Altenburg, Ph.D," <cdalten@gmail.com> - 2020-03-06 05:52 -0800

Page 2 of 2 — ← Prev page 1 [2]


#39346

FromDaniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Date2020-03-06 17:47 +0100
Message-ID<r3tur0$1to$1@dont-email.me>
In reply to#39342
On 2020-03-06 14:49, C.D. Altenburg, Ph.D, wrote:
> public boolean groupSum(int start, int[] nums, int target) {
>   // Base case: if there are no numbers left, then there is a
>   // solution only if target is 0.
>   if (start >= nums.length) return (target == 0);
>   
>   // Key idea: nums[start] is chosen or it is not.
>   // Deal with nums[start], letting recursion
>   // deal with all the rest of the array.
>   
>   // Recursive call trying the case that nums[start] is chosen --
>   // subtract it from target in the call.
>   if (groupSum(start + 1, nums, target - nums[start])) return true;
>   
>   // Recursive call trying the case that nums[start] is not chosen.
>   if (groupSum(start + 1, nums, target)) return true;
>   
>   // If neither of the above worked, it's not possible.
>   return false;
> }

Pretty.

> Dumbass.

Ugly.

-- 
DF.

[toc] | [prev] | [next] | [standalone]


#39361

From"C.D. Altenburg, Ph.D," <cdalten@gmail.com>
Date2020-03-07 05:42 -0800
Message-ID<03e438f7-15bd-461f-9ae4-5cd96ba8226c@googlegroups.com>
In reply to#39346
On Friday, March 6, 2020 at 8:47:37 AM UTC-8, Daniele Futtorovic wrote:
> On 2020-03-06 14:49, C.D. Altenburg, Ph.D, wrote:
> > public boolean groupSum(int start, int[] nums, int target) {
> >   // Base case: if there are no numbers left, then there is a
> >   // solution only if target is 0.
> >   if (start >= nums.length) return (target == 0);
> >   
> >   // Key idea: nums[start] is chosen or it is not.
> >   // Deal with nums[start], letting recursion
> >   // deal with all the rest of the array.
> >   
> >   // Recursive call trying the case that nums[start] is chosen --
> >   // subtract it from target in the call.
> >   if (groupSum(start + 1, nums, target - nums[start])) return true;
> >   
> >   // Recursive call trying the case that nums[start] is not chosen.
> >   if (groupSum(start + 1, nums, target)) return true;
> >   
> >   // If neither of the above worked, it's not possible.
> >   return false;
> > }
> 
> Pretty.
> 
> > Dumbass.
> 
> Ugly.
> 

The guy is clueless, dense, and I would NEVER consider hiring someone like that for any kind of tech job at my firm in San Francisco.

[toc] | [prev] | [next] | [standalone]


#39347

FromEric Douglas <e.d.programmer@gmail.com>
Date2020-03-06 09:03 -0800
Message-ID<2dbe9104-3055-41ff-812f-3c749db3b813@googlegroups.com>
In reply to#39342
On Friday, March 6, 2020 at 8:49:23 AM UTC-5, C.D. Altenburg, Ph.D, wrote:
> On Thursday, March 5, 2020 at 9:29:17 AM UTC-8, Eric Douglas wrote:
> > On Thursday, March 5, 2020 at 8:53:46 AM UTC-5, C.D. Altenburg, Ph.D, wrote:
> > > > They all sound like beginner problems.  What section is that in?
> > > 
> > > Again, I don't think these are beginner problems. Because again, I was never taught this kind of stuff in the lower division CS classes in undergrad school. For us, the beginner problems included simple for and while loops.
> > > 
> > > And the section with the backtracking problems are...
> > > 
> > > https://codingbat.com/java/Recursion-2
> > 
> > For the first problem in that section, not sure why they said do it with no loops?  The only obvious answer involves a loop.
> > public boolean groupSum(int start, int[] nums, int target) {
> >         if (target == 0) {
> >             return true;
> >         }
> >         if (start == nums.length - 1) {
> >             return nums[start] == target;
> >         }
> >         for (int n = start + 1; n < nums.length; n++) {
> >             if (groupSum(n,nums,target) || groupSum(n,nums,target-nums[start])) {
> >                 return true;
> >             }
> >         }
> >         return false;
> > }
> 
> That's what makes it hard. You're supposed to use no for loops. And here is the solution without a for loop
> 
> public boolean groupSum(int start, int[] nums, int target) {
>   // Base case: if there are no numbers left, then there is a
>   // solution only if target is 0.
>   if (start >= nums.length) return (target == 0);
>   
>   // Key idea: nums[start] is chosen or it is not.
>   // Deal with nums[start], letting recursion
>   // deal with all the rest of the array.
>   
>   // Recursive call trying the case that nums[start] is chosen --
>   // subtract it from target in the call.
>   if (groupSum(start + 1, nums, target - nums[start])) return true;
>   
>   // Recursive call trying the case that nums[start] is not chosen.
>   if (groupSum(start + 1, nums, target)) return true;
>   
>   // If neither of the above worked, it's not possible.
>   return false;
> }

So the next one was even easier.  Some of these take a bit more thought but not genius level puzzles.

public boolean groupSum6(int start, int[] nums, int target) {
  if (nums.length == 0) { return target == 0;}
  if (start == nums.length - 1) { return (target == nums[start] || (target == 0 && nums[start] != 6));}
  if (groupSum6(start + 1,nums,target - nums[start])) {return true;}
  if (nums[start] != 6 && groupSum6(start + 1,nums,target)) {return true;}
  return false;
}

[toc] | [prev] | [next] | [standalone]


#39337

Fromchad altenburg <cdalten@gmail.com>
Date2020-03-05 07:22 -0800
Message-ID<c4726fd0-611e-49a1-a8c6-6b8a962c54d7@googlegroups.com>
In reply to#39327
On Wednesday, March 4, 2020 at 9:59:30 AM UTC-8, Eric Douglas wrote:
> On Wednesday, March 4, 2020 at 8:53:22 AM UTC-5, chad altenburg wrote:
> > Some of those problems aren't for beginners. Seriously. There is one section that has a series of problems related to backtracking. And the last time I checked, backtracking wasn't taught in an introductory programming class.
> > 
> They all sound like beginner problems.  What section is that in?

Also, I'm considering adding you to my killfile because I'm getting this distinction impression that you aren't the sharpest tool in the shed. In other words, I'm getting this person that you're a human being of limited intelligence.

[toc] | [prev] | [next] | [standalone]


#39338

FromEric Douglas <e.d.programmer@gmail.com>
Date2020-03-05 07:48 -0800
Message-ID<6ea32d18-22be-4c7b-9261-8dacd59e4143@googlegroups.com>
In reply to#39337
On Thursday, March 5, 2020 at 10:23:09 AM UTC-5, C.D. Altenburg, Ph.D, wrote:
> Also, I'm considering adding you to my killfile because I'm getting this distinction impression that you aren't the sharpest tool in the shed. In other words, I'm getting this person that you're a human being of limited intelligence.

Not sure where that attack came from. Normally killfiles are for bots, spammers, and personal attacks. Perhaps I'm just not grasping what ought to be too difficult for 'beginners' (generally 2 kinds of beginners, ones who have never coded before, and ones new to a specific language) because I've been coding for decades but a little recursion doesn't sound that complicated to me.  Sorry if you took offense to that but it sounds like you are the one of limited intelligence.  Have you ever taken an IQ test?  What was your score?  Find me your hardest problem from that site, I'd be happy to help solve it.

[toc] | [prev] | [next] | [standalone]


#39343

From"C.D. Altenburg, Ph.D," <cdalten@gmail.com>
Date2020-03-06 05:50 -0800
Message-ID<c9dbb2f7-3455-419d-a255-f650041d8753@googlegroups.com>
In reply to#39338
On Thursday, March 5, 2020 at 7:49:03 AM UTC-8, Eric Douglas wrote:
> On Thursday, March 5, 2020 at 10:23:09 AM UTC-5, C.D. Altenburg, Ph.D, wrote:
> > Also, I'm considering adding you to my killfile because I'm getting this distinction impression that you aren't the sharpest tool in the shed. In other words, I'm getting this person that you're a human being of limited intelligence.
> 
> Not sure where that attack came from. Normally killfiles are for bots, spammers, and personal attacks. Perhaps I'm just not grasping what ought to be too difficult for 'beginners' (generally 2 kinds of beginners, ones who have never coded before, and ones new to a specific language) because I've been coding for decades but a little recursion doesn't sound that complicated to me.  Sorry if you took offense to that but it sounds like you are the one of limited intelligence.  Have you ever taken an IQ test? 

SAT is considered a more accurate measure of intelligence than an IQ

[toc] | [prev] | [next] | [standalone]


#39344

From"C.D. Altenburg, Ph.D," <cdalten@gmail.com>
Date2020-03-06 05:52 -0800
Message-ID<f88b045d-3cd8-4dd7-aa29-2caf2701c88f@googlegroups.com>
In reply to#39338
On Thursday, March 5, 2020 at 7:49:03 AM UTC-8, Eric Douglas wrote:
> On Thursday, March 5, 2020 at 10:23:09 AM UTC-5, C.D. Altenburg, Ph.D, wrote:
> > Also, I'm considering adding you to my killfile because I'm getting this distinction impression that you aren't the sharpest tool in the shed. In other words, I'm getting this person that you're a human being of limited intelligence.
> 
> Not sure where that attack came from. Normally killfiles are for bots, spammers, and personal attacks. Perhaps I'm just not grasping what ought to be too difficult for 'beginners' (generally 2 kinds of beginners, ones who have never coded before, and ones new to a specific language) because I've been coding for decades but a little recursion doesn't sound that complicated to me.  Sorry if you took offense to that but it sounds like you are the one of limited intelligence.  Have you ever taken an IQ test?  What was your score?  Find me your hardest problem from that site, I'd be happy to help solve it.

Well, if you ever tried to apply to the ivy league schools like Harvard or Princeton, you would have realized that SAT scores are a more accurate measure of intelligence. And the fact that you think that an IQ test is an accurate measurement only reinforces my notion that you don't appear to be that bright.

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.java.programmer


csiph-web