Posts by Wilk Maia • 55 points
6 posts
-
1
votes2
answers93
viewsA: How to correctly iterate all records of a structure with multiple depth levels in Rust?
If the idea is simply to iterate, I think a simpler solution is more valid. Given the proposed modulation: struct Node { id: i64, nodes: Vec<Node>, } We can simply build a function that takes…
-
1
votes4
answers2467
viewsA: Algorithm for calculating verifier digit
Not taking into consideration specificities of languages (given the theme of Algoritmos): Your solution seems adequate. You can take user input as a string and work with each character. Have,…
-
0
votes3
answers123
viewsA: problem with inversion of values of a vector
A generic and elegant way to solve this problem is to convert the numbers into strings and analyze them digit by digit. This way, your solution is independent of the maximum possible number of…
-
0
votes6
answers49406
viewsA: how to search for an element in a list that is inside another list?
The previous answers, from what I understand, work well for the given example. However, if we have an entry with a larger nesting, say [[[1, 2], [[[3]]]]], no solution previously presented will give…
-
0
votes1
answer136
viewsA: How to pass this parameter to a void function?
Its function print_bytes receives a pointer in end_byte. So you can assign to k the entire value to which that pointer points you must make: k = * (int*)end_byte; This syntax is telling the compiler…
-
0
votes1
answer149
viewsA: I made a very simple game in Python but it goes into an infinite loop, could someone please help me with this?
The loop problem lies in the fact that you are using the function raw_input to assign the value to the variable resp and be comparing this value to an integer. If the user type 0, the value that is…