rinku11's blog

By rinku11, history, 3 years ago, In English

Here I'm doing searching work only.unordered_map<>takes O(1) for searching and map<>takes O(long) for searching so I didn't get that why I'm getting tle. Here is my code link -:

https://codeforces.me/contest/1642/submission/147498144

Above is my tle code.

Full text and comments »

  • Vote: I like it
  • -10
  • Vote: I do not like it

By rinku11, history, 3 years ago, In English

Here is the brief explanation of my question -:

Given an array of positive and negative numbers, arrange them in an alternate fashion such that every positive number is followed by negative and vice-versa maintaining the order of appearance. Number of positive and negative numbers need not be equal. If there are more positive numbers they appear at the end of the array. If there are more negative numbers, they too appear in the end of the array.

Example: Input: arr[] = {1, 2, 3, -4, -1, 4} Output: arr[] = {-4, 1, -1, 2, 3, 4}

Input: arr[] = {-5, -2, 5, 2, 4, 7, 1, 8, 0, -8} output: arr[] = {-5, 5, -2, 2, -8, 4, 7, 1, 8, 0}

I'm trying to solve this problem with the constraint O(n) time complexity and O(1) space complexity.But I didn't get any logic

Full text and comments »

  • Vote: I like it
  • -49
  • Vote: I do not like it

By rinku11, history, 3 years ago, In English

Here is the question link which I solved-:https://codeforces.me/contest/1617/problem/A Here is my submission code-:https://codeforces.me/contest/1617/my After going to this link plz go to the latest submission to see my code.

This code works fine in all other IDE (CodeChef,VsCode,Hackerrank) .But when I submit my code on codeforces running contest it gives me errors. Plz, anybody help me out.

Full text and comments »

  • Vote: I like it
  • -21
  • Vote: I do not like it