Hitachi Data Systems Interview Question for Software Engineer / Developers


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
    return top_prospect

- KILLerEGG April 20, 2017 | Flag Reply
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
return top_prospect

- KILLerEGG April 20, 2017 | Flag Reply
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)
}

- pbox April 20, 2017 | Flag Reply
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;

}

- RP April 21, 2017 | Flag Reply
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;
}
}
}
}
}

- Anonymous April 24, 2017 | Flag Reply


Add a Comment
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.

Learn More

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.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More