[VicPiMakers Projects] Jims challenge in google sheets + a bit of javascript in google apps

Greg H greg.horie at gmail.com
Tue Oct 20 08:52:08 EDT 2020


> Test Input: 72,111,63,85,61,56,118,121,61,69,63,61

> Output #5: 5,61,61,61,63,63, (#repeats, list)

Here's how I interpret this. Given a list of integers, find all the values
that repeat. Total the number of repeat values. This total is the first
field in the output. Then sort the repeat values and join them as a
comma-delimited list to the output.

In the example we find that 61 repeats 3 times and 63 repeats 2 times. 3 +
2 = 5.

Output Format:  <total>,<comma-delimited list of sorted repeats>
Hence:  5,61,61,61,63,63

Note - The last comma in the example output is distracting, so I removed it.







On Tue, 20 Oct 2020 at 00:40, George Bowden <gtbowdeng at gmail.com> wrote:

> Here is my answer
> <https://docs.google.com/spreadsheets/d/1OFoQq69r5HlJ1udis0htAQqiEsLxvUcoZu9iSEuAeH0/edit?usp=sharing>
> to Jims challenge in google sheets + a bit of javascript in google apps
> I spent days seeing how to do this in forth language, but gave in to my
> weaker self...
>
> My inputs are limited to 26 numbers.  Well, everyone has their limits
> <grin>.
> Here is the javascript for #9.
>
> function myF(str) {
>   var returnStr="";
>   for (let i = 0; i < str.length; i++) {
>      var c = str[i];
>      if((c >= 'A') && (c <= 'Z')) {           // Concatenate the next char
> only if it's a capital letter.
>        returnStr=returnStr+c;
>      }
>   }
>   return returnStr;
> }
>
> I couldnt understand question 5.
>
> --
> George Bowden,
> gtbowdeng at gmail.com
> --
> Projects mailing list
> Projects at vicpimakers.ca
> http://vicpimakers.ca/mailman/listinfo/projects_vicpimakers.ca
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://vicpimakers.ca/pipermail/projects_vicpimakers.ca/attachments/20201020/b65eb707/attachment.htm>


More information about the Projects mailing list