We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Data Structures
- Arrays
- Dynamic Array
- Discussions
Dynamic Array
Dynamic Array
Sort by
recency
|
2014 Discussions
|
Please Login in order to post a comment
С# solution (Half of difficulty its figure out what the task is actually...)
Task explanation(if someone needed): We have an input : [[type, x, y]] , where type - type of queries( if 1 - add y in list(using formula), if 2 - extract element using second formula and add to lastAnswer ). x - parametr, what we using in formula which calculate index where we need to insert/extract y. y - parameter, what we insert/extract.
this is the code from in java but totally with normal array not ArrayList.
import java.util.Scanner;
public class HourGlass { public static void main(String[] args) { Scanner s = new Scanner(System.in); int[][] array = new int[6][6];
}
Giving those of us trying to understand the problem code examples of the solution isn't really ideal. This challenge is incredibly perscriptive rather than descriptive of some logical problem to solve. The perscription isn't very well written either. It would be incredibly useful if someone were to re-write an actual problem description rather than a solution.
Took me a while to understand the problem and the input description. Here is the code in golang: