[LivePerson面经】Onsite Interview 其他公司 Onsite 开发岗 数据岗 其他岗位

飞天猪 2020-7-2 982


Implement a Call-center Conversation routing mechanism based of the following three methods.

  • addAgent(agentId)
  • assignConversationToAgent (conversationId) return agentId // Assigns this Conversation to next available agent.
  • finishConversation (conversationId) // Clean-up all.

image

Traverse the elements represented in a circular fashion in the image. At any position P, we are free to traverse in either direction - clockwise or anti-clockwise. From position P, we must traverse through K steps, represented by the integer at position P, in either direction as specified previously. Begin at any position P and return any one traversal-pattern such that no position P is repeated twice in the result, but all positions P have been visited at least once.

3 <= P <= Unlimited. 1 <= K <= Unlimited.

Example Output of given image - Begin at Top. Traverse Clock-wise 2 steps. Pick 3 into result. Continue at 3 and traverse clock-wise 3 steps. Pick Right 2 into result. Continue at Right-2, traverse clock-wise 2 steps and pick 1. We have completed our traversal and have picked all P positions. 2 -> 3 -> 2 -> 1 Traversing anti-clockwise while beginning at Top and at any position may not have generated any result.

最新回复 (0)
返回