Rakuten Interview Question

Deduplication of table Basic solution and efficient one