time complexity calculator online
A = [1,2,3,4,5] for i in A: print(i)
time complexity calculator online
void postorderTraversal(struct Node* node) { if (node == NULL) return; postorderTraversal(node->left); postorderTraversal(node->right); cout << node->data << "->"; }
time complexity calculator online
#include<bits/stdc++.h> using namespace std; int main() { int a,b; a = 1; b = 1; while(b < n) { a += 1; b += a; cout<<"Hi"; } }
time complexity calculator online
tell me th time complexity of the given code
time complexity calculator online
for (i = n; i > 0; i /=2) a++;
time complexity calculator online
class Solution { public: int minStoneSum(vector<int>& piles, int k) { int sum=accumulate(piles.begin(), piles.end(), 0); while(k!=0){ int i=*max_element(piles.begin(),piles.end()); std::vector<int>::iterator it = std::find(piles.begin(), piles.end(), i); int index = std::distance(piles.begin(), it); int t=floor(piles[index]/2); piles[index]=i-t; sum=sum-t; k--; } return sum; } };
time complexity calculator online
void fun (int n) { if (n ≤ 0) return; printf (“*”); fun(n-1); fun(n/2); }
time complexity calculator online
int smallLengthSubarraySum(int arr[], int n, int S) { int i; int wstart = 0, len = INT_MAX; int subSum = 0; for(i = 0; i < n; i++) { subSum += arr[i]; while(subSum >= S) { int currentWindowSize = i - wstart + 1; if(currentWindowSize < len) len = currentWindowSize; subSum -= arr[wstart]; wstart++; } } return len == INT_MAX ? 0 : len; }
time complexity calculator online
int func(int n) count=0 lv=n while(lv > 0) inner_lv=0 while(inner_lv < lv) inner_lv++ count+=1 lv/=2 return count
time complexity calculator online
Sum =0; for ( i=0; i<n; i++) for ( j=0; j<n*n; j++) Sum += j;