Data Model: LinkedIn data model - model for 1st degree connection Python: 1. Dedup items in the list - retaining the order of items. ==> cannot use dict/set since order will not be retained. Follow up question on this - How would you handle nested lists? (they are looking for recursion) 2. Find the number of words in a sentence /avg length of word SQL On the product-sales-customers data model that is preloaded in coderpad.io, write the following queries 1. Count of stores in OR state with area_sqft > 25000 2. avg number of Female Customers group by state 3. Customer FirstName, Last Name and count of unqiue products purchased by state followup question - Return the top customer by state based on diverse product purchased (diverse = count(distinct product_id))
Anónimo
Python: 1. dedup - create new list and append items from input list while checking it is not in the output list. this will retain order. to handle nested lists, 2 approached. option 1 Flatten the input_list as Flat_Input_List and run thro' the same logic. option 2 recursion by declaring output_list in outer scope. TIPS: They don't expect you to use Set / Dict to de-dup since it doesn't retain the order They don't expect you to use all built in functions, since they are looking to test ur logical thinking Use the right data structure Use recursion logic 2. this is straight forward. Already in glassdoor and worked out answers in geekforgeeks. TIP: make sure to do input_validation/handling corner cases like empty string / None etc SQL Just need to be familiar with 1. Window functions using Partition by State / dense_rank() to get rank = 1 2. logic to get % 3. logic with CASE statement with in COUNT or SUM 4. use ROUND () 5. use Left join when needed - see results if it has all states with 0 for non-matching rows. select round((sum((case when promotion_id > 0 then store_sales else 0.0 end)) / sum(store_sales))*100,2) promoted, round((sum((case when promotion_id = 0 then store_sales else 0.0 end)) / sum(store_sales))*100,2) non_promoted from sales select count(*), sum(area_sqft), state from stores group by state having sum(area_sqft)>25000 # select p.product_id, sum(store_sales) from sales s inner join products p on s.product_id = s.product_id group by p.product_id order by sum(store_sales) desc