ServiceNow计算机科学面试真题

职位分类
全部
数据相关
计算机科学
人工智能
产品经理
BQ
面试题
全部(37)
OOD(11)
Algorithm(14)
System Design(10)
高频题(0)
Math(0)
全部(37)
OOD(11)
Algorithm(14)
System Design(10)
高频题(0)
Math(0)
1.Implement preOrder and postOrder Traversal for a B-Tree in Java
2.Maximize Product of Five Numbers in an Array
3.Linkedlist Middle Node and Loop Detection
4.Basic Binary Search
5.Count and Say Problem
6.Basic Knowledge Questions
7.JavaScript Design: MySet Implementation
8.Java Design: Roman To Integer Converter
9.Design a CSV File Reader and Calculator
10.Find First Missing Positive Number
11.Move Zeroes to the Right
12.Match Nuts and Bolts Optimally
13.Debugging a File Directory Implementation in JavaScript
14.Optimize the Service for High Traffic
15.Handle Distance Calculation for Multiple Users
16.Convert the Solution to Object-Oriented Design
17.Find the Closest Coffee Shops
18.Modified 2Sum Problem
19.Terminal commands to list all Java processes
20.How to check if a user form is filled out correctly
21.How to verify the validity of a Social Security Number (SSN)
22.Write test cases for different fields considering character length and type
23.Find All Pairs in an Integer Array with Sum Equal to a Target Value
24.Troubleshooting a Hanging Process
25.How would you design a deck of playing cards in a database?
26.What are the principles of Object-Oriented Programming (OOP)?
27.What is polymorphism in computer science?
28.Design a query function for an unsorted array to find the minimum value within a given range
29.Algorithm to find the minimum absolute difference between elements of two sorted arrays
30.Implement a JavaScript function to extend all arrays with a method to get the cube of their elements
31.Matrix Zeroes Problem
32.Object-Oriented Design: Elevator System
33.Design Patterns Knowledge
34.Java Versions: Differences between Java 7 and Java 8
35.Data Structures: Stack vs Queue
36.Valid Words Count in a String
37.System Design Interview
1. Implement preOrder and postOrder Traversal for a B-Tree in Java
Discuss the preOrder traversal for a B-Tree and implement it in Java. Write the Node class and print the preOrder output. Provide both recursive and iterative implementations. As a follow-up, implement the postOrder traversal using an iterative approach. Consider the possibility of duplicate values and discuss how you might handle them, for example, using a stack or a set to store nodes. Finally, explain how postOrder can be thought of as a mirrored version of preOrder, where you would change the order of pushing children and then reverse the result to achieve the postOrder output.
2. Maximize Product of Five Numbers in an Array
Given an array, find the maximum product that can be obtained from any five numbers in the array. The solution should consider the following cases: the product of the five largest positive numbers, the product of the two smallest negative numbers and the three largest positive numbers, and the product of the four smallest negative numbers and the largest positive number. You should not sort the array; instead, scan through the data once to find the five largest positive numbers and the four smallest negative numbers, then compare to find the maximum product. Write code to implement this logic.
3. Linkedlist Middle Node and Loop Detection
Write a function to find the middle node of a linked list, and another function to detect a loop in a linked list using the fast and slow pointer technique.
4. Basic Binary Search
Write the most basic form of binary search without any variations.
5. Count and Say Problem
Implement a function that transforms a string by counting the consecutive characters. For example, the input 'aaabbcdd' should be converted to 'a3b2c1d2'.