You have to do a function, that takes an array of structs. Each one of these structs will contain integer X, Y coordinates from 0 to 10.
You need to determine the order in which to move the coordinates for each struct and which one travelled the shortest distance.
The structs can move one-by-one (easy) or all at the same time (i don't know if this is even possible). The function needs to return the order of movement for each struct and distance travelled of each struct.
Do your own homework, no one is falling for your bait
Eli Gonzalez
>>>/stackoverflow.com/
Nicholas Parker
I said any language, it is not a homework. I just want to see it being done in multiple languages
Tyler Rogers
I just got into coding, currently learning C, can anyone post that coding challenge pic?
Logan Jones
>You need to determine the order in which to move the coordinates for each struct and which one travelled the shortest distance. What? > The structs can move one-by-one (easy) or all at the same time (i don't know if this is even possible). The function needs to return the order of movement for each struct and distance travelled of each struct. What? What movement?
Adam Brooks
Imagine it like a class. Each instance has two variables: int X and int Y
You "move" them by changing the two values
Aaron Butler
>got a C task >>let's do it guise, any language! >someone does it in C finally >>got em
Camden Brown
It is not my fucking homework! Do you really think that someone would assign such a trivial task?
Hudson Scott
Do it yourself in those languages then, fucking faggot.
Cameron Thompson
if it is such a trivial task why don't you do it in other languages?
Dylan Gutierrez
>trivial >OP admits he himself is retarded, literally and unironically Go die in a fire you prepubescent bitch. You're not old enough to be posting on this website
Carson Jenkins
Because i'm not good at imagining the solution and i didn't find it on rosetta code
Jackson Fisher
>i'm not good at imagining the solution why are you even trying to code then? you don't think you should work on that before moving on?
Nathaniel Hughes
You need to clearly define the task/problem, which you haven't done at all
Logan Moore
move them to what you fucking mongoloid? do you pass it a target position to move towards?
Ryan Jenkins
is this?
#include #include
struct pos { int x, y, sum; }; void main(void){ int n = 5, l; /*scanf("%d",&n);*/ struct pos p[n]; for(int x=0; x
Jordan Walker
> You need to determine the order in which to move the coordinates for each struct and which one travelled the shortest distance. int[] order; int[] distanceTravelled; int shortest; for (int i = 0; i < gayStructsArray.length; i++) { order[i] = i + 1; distanceTravelled[i] = 0; } shortest = 0;
There you go. I simply assumed they would all stay in place (since that's consistent with your problem specification).
Adrian Rivera
This one is perfect. I wanted to see it being done in the cleanest and most elegant way possible, this is what i wanted
Jordan Hall
I'm really sorry for not describing the challenge more. but 66373178 managed it, so it was possible
Dominic Price
Given that you have given no rules as to how these structs must be positioned at the end the following should be valid.
Return([0 for I in range(Len(inpiut))])
Julian Nguyen
i is clever, i guess you pass
Benjamin Butler
oops, i meant "this is clever". sorry
Xavier Allen
This was my thought, i mean, the question is obviously incomplete.