# Dinesh babu U R
- Javascript, Golang, nodejs, React
- Microservices, Lambda, SQS, SNS, kinesis, Athena, Glue
- Dynamodb, PSQL, Cassandra
- Messaging Queue - kafka
- Good with Ds/algo
- Ok with DB design
- OK with System design
# Question 1:
[1, 2, 3, 2, 3, 4, 2, 3, 4, 2, 3]
maxWeight = 6
[1, 1, 2, 2]
3
```javascript!
// logic
[1, 2, 2, 3, 4]
[1]
[1,2] [2,1]
[1,2,2] [1,2,3] [1,2,4] [1,3,4]
[1,2,2,4]
[[4,2]]
6
let arr = [1,1,2,2]
function findMinimalSubArray(arr, limit){
let length = arr.length;
Arrays.sort(arr)
let begin = 0
let end = length-1
let outputArr = []
let unit = []
let currSum = 0
while(begin < end ){
if(arr[end] + currSum <= limit){
currSum += arr[end]
unit.push(arr[end])
end--
} else if(arr[begin] + currSum <= limit) {
currSum += arr[begin]
unit.push(arr[begin])
begin++
} else {
outputArr.push(unit)
unit = []
currSum = 0
}
}
return outputArr
}
```
# DB design.
- user service
- chat service
- one to one chat
- text message
- list of conversations, sorted, last event,
- list of messages, sorted, paginated
user
- user_id
conversations
- conversation_id
- users
- timestamp
messages
- message_id
- conversation_id
- sender_id (user_id)
- receivers_id (user_id)
- content
- timestamp
- read/unread
- AWS API Gateway
- also publish the req payload to SQS
- From SQS -> Lambda -> store it in S3 in this format format - yyyy/mm/dd
- AWS Glue + AWS Athena to Query S3 -> athena query results can be visulized by Quicksight