Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #432: Sequential Logic

AYXAcademy
Alteryx
Alteryx

Maveryx_WC_Banner.png

Hi Maveryx,

 

A solution to last week’s challenge can be found here.

 

Patrick Digan (@patrick_digan)  submitted this challenge that will test your logic skills. Thank you, Patrick, for submitting this great challenge!

 

You have a dataset that looks like this:

 

Record

A

B

C

1

1.0

0.0

0.0

2

1.0

0.0

0.0

3

2.0

1.0

0.0

4

?

?

?

 

Your task is to generate rows for records 4 through 25 (1 to 3 will stay the same), and calculate the values of A, B, and C for each row.

 

The general logic to determine the values in columns A, B, and C for records 4-25 is:

  • Column A: Calculate the sum of all numbers in the previous row.
  • Column B: Subtract B from A in the previous row.
  • Column C: Subtract B and C from A in the previous row.

 

Hint: You will need to make sure that you calculate the values record by record.

 

Example for Record 4:

A=2+1+0=3

B=2-1=1

C=2-1-0=1

 

Example for Record 5:

A=3+1+1=5

B=3-1=2

C=3-1-1=1

 

Need a refresher? Review the following lessons in Academy to gear up.

 

Good luck!

 

AYX-Maveryx_Micro Identity-Maveryx Academy_wordmark.png

AkimasaKajitani
17 - Castor
17 - Castor

My solution. I think there is an easier solution than mine. But my brain has no idea except this one.

 

Spoiler
Clipboard02.png


Hmm...It's a bit complex expression!
IF [ABC]="::" THEN
ToString(
ToNumber(GetLeft([Row-1:ABC], ":"))+
ToNumber(GetPart([Row-1:ABC], ":",1))+
ToNumber(GetPart([Row-1:ABC], ":",2))
)+":"+
ToString(
ToNumber(GetLeft([Row-1:ABC], ":"))-
ToNumber(GetPart([Row-1:ABC], ":",1))
)+":"+
ToString(
ToNumber(GetLeft([Row-1:ABC], ":"))-
ToNumber(GetPart([Row-1:ABC], ":",1))-
ToNumber(GetPart([Row-1:ABC], ":",2))
)
ELSE [ABC] ​

abe_ibanez
9 - Comet

My solution: 

Spoiler
Main workflow
main.png
Iterative Macro
macro.png

 

 

ggruccio
ACE Emeritus
ACE Emeritus

My first thought was iterative macro!

 

A bit messy - but works!!!

 

Spoiler
Screenshot 2024-07-08 112724.pngScreenshot 2024-07-08 112738.png
Kenda
16 - Nebula
16 - Nebula
Spoiler
image.png
patrick_digan
17 - Castor
17 - Castor

I'm glad to see this problem made it to the weekly challenges! After you've solved it, here's something interesting:

 

Spoiler
Did you notice that all 3 columns are the Fibonacci sequence

 

 

RolandSchubert
16 - Nebula
16 - Nebula
Spoiler
432.jpg

Fibonacci rewritten ... 

ed_hayter
12 - Quasar

Good one

 

Spoiler
image.png

image.png

 

RashedDS
8 - Asteroid
Spoiler
432.JPG

balajilolla2
9 - Comet
Spoiler
Solution Attached

Screenshot 2024-07-08 115645.jpg