Mathematical

- Linked List, Linked Lists, Mathematical, partition

Partition a Linked List into K continuous groups with difference in their sizes at most 1

  #include using namespace std;  struct ListNode {    int val;    struct ListNode* next;};  void push(ListNode** head_ref,          int node_val){        ListNode* new_node = new ListNode();          new_node->val = node_val;          new_node->next = (*head_ref);          (*head_ref)…

Read More

- frequency-counting, Google, Hash, Mathematical, Strings

Minimum time required to complete all tasks without altering their order

  import java.util.*;  class GFG {                  static void findMinimumTime(        String tasks, int K)    {                        Map map            = new HashMap();                  int curr_time = 0;                  for (char c : tasks.toCharArray()) {                                      if…

Read More