Open In App

WonderLend Hubs Interview Experience for SSE

Last Updated : 29 Aug, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

There were total 3 rounds:

  1. DSA + System design
  2. Technical + managerial round
  3. HR

Round 1 :

  • Basic questions on current project and contributions
  • Flatten a JSON document

Java




import java.io.*;
import java.util.*;
  
class GFG {
    public static void main(String[] args) {
        flattener("", getJson());
    }
  
    static void flattener(String parentKey, Map<String, Object> nodes) {
        for (Map.Entry<String, Object> entry : nodes.entrySet()) {
            String key = entry.getKey();
  
            if (isPrimitive(entry.getValue())) {
                System.out.println(parentKey + getSeparator(parentKey) + key + " : " + entry.getValue());
            } else {
                if (entry.getValue() instanceof Map) {
                    flattener(parentKey + getSeparator(parentKey) + key, (Map<String, Object>) entry.getValue());
                } else if (entry.getValue() instanceof List) {
                    flattener(parentKey + getSeparator(parentKey) + key, convertToMap((List<Object>) entry.getValue()));
                }
            }
        }
    }
  
    static String getSeparator(String parentKey) {
        return parentKey.isEmpty() ? "" : ".";
    }
  
    static Map<String, Object> convertToMap(List<Object> arr) {
        Map<String, Object> map = new HashMap<>();
        for (int i = 0; i < arr.size(); i++) {
            map.put(String.valueOf(i), arr.get(i));
        }
        return map;
    }
  
    static boolean isPrimitive(Object o) {
        return o instanceof Number || o instanceof String || o instanceof Boolean;
    }
  
    public static Map<String, Object> getJson() {
        Map<String, Object> jsonData = new HashMap<>();
  
        jsonData.put("name", "john doe");
  
        Map<String, Object> details = new HashMap<>();
        details.put("a", 1);
        details.put("b", 2);
        details.put("c", 3);
  
        ArrayList<Object> dArray = new ArrayList<>();
        Map<String, Object> dObject = new HashMap<>();
        dObject.put("a", 1);
        dArray.add(dObject);
        dArray.add(5);
        dArray.add("f");
  
        details.put("d", dArray);
  
        jsonData.put("details", details);
        return jsonData;
    }
}


Output

name : john doe
details.a : 1
details.b : 2
details.c : 3
details.d.0.a : 1
details.d.1 : 5
details.d.2 : f

  • Scaling and db issues faced till yet
  • udp vs tcp for youtube and ipl score
  • scaling mongo and sharding related usecases
  • OS process vs thread

Round 2:

1. There is rest controller and a filter in spring boot app. Controller has a get method having request param called as message = “m(nth user)”. User object is mapped to both classes using autowiring. but there can be concurrency issues. since filter might have some other user and the message might be of some other user. How to resolve this. The constraints were we cannot change controller and filter class.

2. Why are the lids always circular on roads for manholes, etc.

Round 3:

HR and basic Background check



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads