aj
BAN USER- 0of 0 votes
Answers/*
- aj in United States
Tree:
1
/ \
3 5
/ \ \
2 4 7
/ \ \
9 6 8
==========
Expected Output:
1
35
247
968
*/
class TreePrinter {
static class Node {
int value;
Node left;
Node right;
public Node(int value, Node left, Node right) {
this.value = value;
this.left = left;
this.right = right;
}
}
public void printTree(Node root) {
// implementation here
}| Report Duplicate | Flag | PURGE
Linkedin Applications Developer Coding - 0of 0 votes
Answers/*Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for water and both would die. Given a flowerbed (represented as an array containing booleans), return if a given number of new flowers can be planted in it without violating the no-adjacent-flowers rule
- aj in United States
Sample inputs
Input: 1,0,0,0,0,0,1,0,0
3 => true
4 => false
Input: 1,0,0,1,0,0,1,0,0
1 => true
2 => false
input: 0
1 => true
2 => false */
public boolean canPlaceFlowers(List<Boolean> flowerbed, int numberToPlace) {
// Implementation here
}| Report Duplicate | Flag | PURGE
Linkedin Applications Developer Coding
- aj June 02, 2015