3 שאלות קוד באתר ייעודי עם צילום ומעקב למניעת הפרה של כללי טוהר מידות.
שאלות מתוך הראיון
שאלה אחת הייתה שאלת SQL פשוטה:
נתונה לך טבלה בשם Students עם העמודות הבאות:
StudentID (מספר זיהוי של התלמיד)
FirstName (שם פרטי)
LastName (שם משפחה)
Age (גיל)
Grade (ציון)
כתוב שאילתת SQL שמחזירה את השמות הפרטיים, שמות המשפחה והציונים של התלמידים שמחזיקים בציון הגבוה ביותר בטבלה.
תשובות
הוסף תשובה
|
לצפיה בתשובות
נובמבר 2024
SELECT FirstName, LastName, Grade
FROM Students
WHERE Grade = (SELECT MAX(Grade) FROM Students);
The data for the number employed at several famous IT companies is maintained in the COMPANY table, Write a query to print the /s of the companies that have more than 10990 employees, in ascending order of 1D.
Input Format
COMPANY
Name Type Description
1D Integer | A company ID in the inclusive range /1, 1000}. This is the primary key.
ANE string | Acompany name. This field contains between 7 and 190characters (inclusive),
enpLovees | Integer | The total number of employees in the company.
Output Format
The result should contain the (0s of all the companies that have more than 10000employees, in ascending order in the following format:
Objective:
You are given an array of integers and need to determine the minimum cost to adjust the array's elements so that the array becomes sorted in either ascending or descending order. The cost of changing an integer in the array to another integer is defined as the absolute difference between the original and the new value.
Details:
- Input: An array of integers.
- Output: The minimum cost to adjust the elements so that the array is sorted in either ascending or descending order.
- Cost Calculation: The cost to change a value `a` to `b` is `|a - b|`, where `|x|` denotes the absolute value of `x`.
Task:
Implement a function `min_cost_to_sort(arr)` that returns the minimum cost required to adjust the elements and sort the array in either ascending or descending order.