Technical Test: Astra Data Science Bootcamp 2019
Technical Test: Astra Data Science Bootcamp 2019
Technical Test: Astra Data Science Bootcamp 2019
Example 1:
Input: s = "anagram", t = "nagaram"
Output: true
Example 2:
Input: s = "cat", t = "car"
Output: false
Note:
You may assume the string contains only lowercase alphabets.
Follow up:
What if the inputs contain unicode characters? How would you adapt your solution to such case?
2. Confused Driver (score: 25)
Truck driver carries secret package through desert. Write a function
input : [(x1,y1), (x2,y,2)]
He was instructed to go to a checkpoint
output : (x3,y3)
then turn left as long as half of the first journey
(from start to the checkpoint) (x1,y1) = start coordinate
Help the driver to get the coordinate of the endpoint (x2,y2) = checkpoint coordinate
directly (x3,y3) = endpoint coordinate
Example 1:
(1,4)
(2,4) (0,4)
Example 2:
input : [(0,0), (0,4)]
output : (-2,4) input : [(1,4), (2,1)]
(3.5,1.5)
output : (3.5,1.5)
(2,1)
(0,0)
3. Top Three Salary on each Dept (score: 20)
The Employee table holds all employees. Every employee
+----+-------+--------+--------------+ +----+----------+
| Id | Name | has an Id, and there is also a column for the department Id.
| Id | Name | Salary | DepartmentId | +----+----------+
| 1 | IT |
+----+-------+--------+--------------+ | 2 | Sales | The Department table holds all departments of the company.
+----+----------+
| 1 | Joe | 85000 | 1 |
Department Table Write a SQL query to find employees who earn the top three
| 2 | Henry | 80000 | 2 |
salaries in each of the department. For the above tables, your
| 3 | Sam | 60000 | 2 | SQL query should return the following rows (order of rows
| 4 | Max | 90000 | 1 | does not matter).
| 5 | Janet | 69000 | 1 | +------------+----------+--------+
| Department | Employee | Salary |
| 6 | Randy | 85000 | 1 | +------------+----------+--------+
| IT | Max | 90000 |
| 7 | Will | 70000 | 1 | | IT | Randy | 85000 |
| IT | Joe | 85000 |
+----+-------+--------+--------------+ | Sales | Henry | 80000 |
| Sales | Sam | 60000 |
Employee Table +------------+----------+--------+
4. Two sample t-test for Equal Means (score: 15)
Given two array of numbers which represent sample of two sample. Write a
function to determine if two population means are equal.
Rainy No
A decision tree is built top-down from a root node and
involves partitioning the data into subsets that contain Rainy No
Rainy No
Notes:
Input: [[‘rainy’,’no’], [‘rainy’,’no’], [‘overcast,’yes’], …] Overcast No
Calculate: E(Weather,Play Football)
Output: Entropy score Overcast Yes
Sunny No
6. Gradient Descent (Score : 15)
Create a function to compute local minimum and number of gradient
descents steps from function f(x) = X5 - 3X3 - 2X2 + 10 with initial X=0.1;