The interview process consisted of six rounds. Initially, I had a call with the HR representative, who was very nice throughout the whole process. She sent me a coding assessment that I could complete in my own time, which was quite easy.
After that, the first two rounds, each lasting an hour, were with different team members. These were coding rounds with three questions each. They did not provide any assistance, and while I was coding, they asked unrelated, random questions. They expected me to solve the problems and answer their questions simultaneously. This was the worst part of the experience. They didn't seem to focus on whether I could program or understand logic, and it felt pointless after a while.
Consider these 3 tables that map hotels to a single city each:
Table 1: costcotravel_ys003_DZ_Hotel
Table 2: costcotravel_ys003_DZ_Hotel_Mapping_to_City
Table 3: costcotravel_ys003_DZ_City
Please write a script to create a stored procedure that takes as its input these variables:
CityCode: exactly 3 characters (but optionally empty) HotelName: Up to 100 characters
and produces the following output fields:
HotelName (the name of the hotel) CityName (the full name of the city)
for records that (1) contain the HotelName input anywhere inside the name of the hotel and (2) if a non-empty CityCode value is supplied, then also match exactly on city code.
Review the EmployeeManager class. Identify and explain the bad practices in the code. Find the bugs that could cause errors during execution. Provide suggestions for improving the code quality and functionality. Consider the following aspects:
Write your review and improvement suggestions. Explain why certain parts of the code are problematic. Suggest specific changes and improvements.
import java.util.List; import java.util.ArrayList;
public class EmployeeManager {
private List<String> employees; // Specify the type of elements in the List
public EmployeeManager() {
employees = new ArrayList<>(); // Use diamond operator for cleaner syntax
}
// Adds an employee to the list
public void addEmployee(String name) {
// Corrected condition: check if name is not null AND not empty
if(name != null && !name.isEmpty()) {
employees.add(name);
}
}
// Removes an employee from the list
public void removeEmployee(String name) {
if(name != null && employees.contains(name)) { // Added null check for name
employees.remove(name);
}
}
// Prints all employees
public void printEmployees() {
// Corrected loop to avoid IndexOutOfBoundsException
for(int i = 0; i < employees.size(); i++) {
System.out.println(employees.get(i));
}
}
// Finds an employee by name
public boolean findEmployee(String name) {
for(String employee : employees) {
// Use .equals() for string comparison, not ==
if(name != null && employee.equals(name)) {
return true;
}
}
return false;
}
// Adds an employee to a database
public void addEmployeeToDatabase(String name, Connection conn) {
PreparedStatement stmt = null;
try {
// Corrected condition: check if name is not null AND not empty
if (name != null && !name.isEmpty()) {
String sql = "INSERT INTO employees (name) VALUES (?)";
stmt = conn.prepareStatement(sql);
stmt.setString(1, name);
stmt.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
} finally { // Ensure the statement is closed
if (stmt != null) {
try {
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
}
Given a list of daily flight prices to Maui, return a list such that, for each day in the input, tells you how many days you would have to wait until a cheaper flight is available.
If there is no future day for which this is possible, put 0 instead.
Example:
given the list of flights [350, 349, 348, 225, 415, 300, 500, 200],
your output should be [1, 1, 1, 4, 1, 2, 1, 0]
For $350, wait 1 day for next lower price of $349
For $349, wait 1 day for next lower price of $348
For $348, wait 1 day for next lower price of $225
For $225, need to wait 4 days for next lower price of $200
You own a small online store, consisting of its own site and a bunch of products presented on it. Your task is to retrieve all the products that are currently contained in the store using the provided REST API.
The current site contains the products represented by the following fields:
id?- the unique identifier of the product (integer); name?- the name of the product (string); updated_at?- timestamp of the last product update (integer); price?- the price of the product (positive integer); manufacturer?(optional) - the name of the manufacturer. This field is optional, and if it is not presented, then the product is considered to be produced locally, by yourself.
To obtain information about the current products from the site, you are given an API endpoint. Use HTTP requests to obtain information about the current products from this endpoint.
API information The API is served at http://127.0.0.1:8081 and supports the only endpoint: A GET request of the form http://127.0.0.1:8081/products This endpoint returns a JSON array, containing a list of JSON objects representing the information about the product with the fields described above.
For example, the response for this endpoint may look like:
[ { "id": 1, "name": "ProductName", "updated_at": 150000000, "price": 100, "manufacturer": "ManufacturerCompanyName" }, { "id": 3, "name": "ProductName 2", "updated_at": 150000230, "price": 90 } ]
Your task is to request an API endpoint and print the information of all the products in the following format:
Product has price and no manufacturer if product has no manufacturer field, and
Product has price and manufacturer otherwise.
The information about the products should be returned in the same order as the products were returned in response.
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
Note: the solution set must not contain duplicate triplets.
Input: nums = [-1,0,1,2,-1,-4] Output: [[-1,-1,2],[-1,0,1]]
Explanation: nums[0] + nums[1] + nums[2] = (-1) + 0 + 1 = 0.
nums[1] + nums[2] + nums[4] = 0 + 1 + (-1) = 0.
nums[0] + nums[3] + nums[4] = (-1) + 2 + (-1) = 0.
The distinct triplets are [-1,0,1] and [-1,-1,2].
The following metrics were computed from 1 interview experience for the Costco Full Stack Software Engineer role in United States.
Costco's interview process for their Full Stack Software Engineer roles in the United States is extremely selective, failing the vast majority of engineers.
Candidates reported having very negative feelings for Costco's Full Stack Software Engineer interview process in United States.