Skip to content

Commit ffc762d

Browse files
authored
Added rust solution for c++ codwe
1 parent 05c36bd commit ffc762d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
impl Solution {
2+
pub fn or_array(nums: Vec<i32>) -> Vec<i32>
3+
{
4+
// Declare answer vector with n-1 elements all initialised to 0
5+
let mut answer: Vec<i32> = vec![0; nums.len()-1];
6+
7+
for i in 0..answer.len()
8+
{
9+
answer[i] = nums[i] | nums[i+1];
10+
}
11+
12+
return answer;
13+
}
14+
}

0 commit comments

Comments
 (0)