Skip to content

Licious Coding Questions - DSA Problems & Solutions

Practice Licious placement paper coding questions with detailed solutions. Access Licious OA coding problems in Java, Python, JavaScript.

This page contains Licious coding questions from Licious OA placement papers with detailed solutions.

Licious OA Coding Section:

  • Problems: 2-3 coding problems
  • Time: 90 minutes
  • Languages: Java, Python, JavaScript
Q1: Recommend products to users based on purchase history.

Solution (Java):

public List<String> recommendProducts(String userId, Map<String, List<String>> purchaseHistory) {
List<String> userPurchases = purchaseHistory.getOrDefault(userId, new ArrayList<>());
Map<String, Integer> productFrequency = new HashMap<>();
// Find products frequently bought together
for (String purchase : userPurchases) {
for (String otherPurchase : userPurchases) {
if (!purchase.equals(otherPurchase)) {
productFrequency.put(otherPurchase,
productFrequency.getOrDefault(otherPurchase, 0) + 1);
}
}
}
return productFrequency.entrySet().stream()
.sorted((a, b) -> Integer.compare(b.getValue(), a.getValue()))
.limit(5)
.map(Map.Entry::getKey)
.collect(Collectors.toList());
}

Time Complexity: O(n²)


Practice Licious coding questions regularly!