Yeah, Rust is brutal when you have lists.
The problem: you get a list, return second half of it. I decided to solve it without using Clone.
Clone
I believe I just found a very idiomatic way to create a single-elemented collection (like HashSet, Vec, VecDeque, etc).
… actually, not a single-elemented. Any fixed number of elements.
I found my own way to learn Rust. After initial ‘impossible’ wall, there is other kind of problem, when you stuck in the middle of an expression and can’t make value to be of a suitable type.
I got myself into simple problem: to split string into pieces by space. During this …ehem… problem I found I need to filter empty splits if there is more than one space in row.
My intial code was:
foo.split("…
foo.split("
Let’s talk about two dimensional matrices in Rust. To be precise, two-dimensional matrices written as nested arrays.
A simple 2x2 matrix is looks like this:
let matrix = [[1, 2], [3, 4]];
I’ve just solved a problem at Leetcode with following signature:
pub fn num_islands(grid: Vec<Vec<char>>) -> i32
When I solved it I changed it to:
pub fn num_islands(mut grid: Vec<Vec<char>>) -> i32 {
I got to a next leetcode crossword. Even before I got to the core of the problem I was puzzled with…
Every language starts with a playground. You CAN do amazing things there, but they are as amazing as a neighboring kid sand cake.
As soon as you move from playground into ‘do something real’ you move from sand cake realm into ‘paper applications with a…
Rehearsal of the things I learned. If you are learning yourself, I advise you to go for the…