## Hitachi Data Systems Interview Question for Software Engineer / Developers

• 0

Country: United States
Interview Type: Phone Interview

Comment hidden because of low score. Click to expand.
3
of 3 vote

``````class Node:
def __init__(self, data, left=None, right=None):
self.data = data
self.left = left
self.right = right

def find_next_largest_in_bst(root, k):
current = root
# Will return None if no possible number can be found in BST
top_prospect = None
while current:
if current.data > k:
top_prospect = current.data
current = current.left
else:
current = current.right

Comment hidden because of low score. Click to expand.
0
of 0 vote

def find_next_largest_in_bst(root, k):
current = root
# Will return None if no possible numbers are found in BST
top_prospect = None
while current:
if current.data > k:
top_prospect = current.data
current = current.left
else:
current = current.right

Comment hidden because of low score. Click to expand.
0
of 0 vote

suppose node structure is like

``````struct node
{
int data;
struct node *left;
struct node *right;
}
int finMax(struct node *root,int k)
{
if(!root)
return -1; if there is no node greater than k
return finMax(root->left,k);
if(root->data > k)
return root->data;
return finMax(root->right,k)
}``````

Comment hidden because of low score. Click to expand.
0
of 0 vote

``````static class TreeNode {
TreeNode left;
TreeNode right;
int data;
}
public static int smallestGreaterInteger(TreeNode root, int k) {
int smallestGreaterInteger = -1;
while (root != null) {
if (root.data > k) {
smallestGreaterInteger = root.data;
root = root.left;
} else {
root = root.right;
}
}
return smallestGreaterInteger;``````

}

Comment hidden because of low score. Click to expand.
0
of 0 vote

//C# Solution

namespace Pratise
{
static class Program
{
static void Main(string[] args)
{
int[] s = {10,20,50,60,22,70,30,80,40};
int t = 20;
int[] n = new int[s.Count()];
for(int k =0; k < s.Count(); k++){
if (s[k] > t )
{
n[k] = s[k];
}
Array.Sort(n);
}
for (int i = 0; i < n.Count(); i++ )
{
if (n[i] == 0)
{
}else
{
Console.WriteLine(n[i]);
break;
}
}
}
}
}

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.