Freshworks Interview Question

Design a Search Engine by looking up the last k strings in it ?