Anisha Joshi
Anisha Joshi
  • 19
  • 309

วีดีโอ

Segregate 0s and 1s || GFG POTD today || easy || 14 july
มุมมอง 1221 วันที่ผ่านมา
time complexity : O(n) [use of a loop] space complexity : O(1) [no extra data structure] check comments for solution : : #dailychallenge #gfg #coding #gfgpotd #programming #gfg #gfgpractice
Remove all occurences of duplicates in a linked list || GFG POTD today || 3 july
มุมมอง 20หลายเดือนก่อน
time complexity - [O(n) we are iterating through the linked list once to create the map of occurrences and then iterating through the map to create a new linked list with unique elements.] space complexity -[ O(n) we are using a map to store the occurrences of each element in the linked list ] . . check comments for code 😀 . . . #gfg #gfgstreak #gfgpotd #potd #easy #programming #coding #dailych...
linked list of strings forms a palindrome || GFG POTD today || 2 july || easy
มุมมอง 19หลายเดือนก่อน
time complexity :[ O(n) using a loop to iterate over the linked list] space complexity :[O(n) storing the whole linked list into a string ] check comments for solution #dailychallenge #coding #gfgpotd #gfg #easy #datastructures
Delete node in Doubly Linked List || gfg potd today || 30th june ||easy
มุมมอง 8หลายเดือนก่อน
time complexity -[O(n) for traversing to the position to be deleted ] space complexity- [O(1) no extra data structure is used] check comments for code #coding #gfg #dailychallenge #gfg #potd #gfgpotd #gfgpotdtoday
Identical Linked Lists || GFG POTD today || 29june || basic
มุมมอง 14หลายเดือนก่อน
time complexity :[ O(n), where n is the number of nodes in the linked lists] space complexity : [O(1) because we are using a constant amount of extra space] check comments for code #coding #gfg #potd #gfgpotd #29june #easy #leetcodechallenge
The Palindrome Pattern || GFG POTD || 28th june || Hard
มุมมอง 28หลายเดือนก่อน
time complexity : [O(n^2) because there are two nested loops iterating over the elements of the 2D array] space complexity : [ O(n) because we are storing the string representation of each row and column in separate variables] check comments for code 😀 #gfg #coding #potd #gfgpotd #dailychallenge #dailycoding #easy #programming
Toeplitz matrix || GFG POTD || 27th june || easy approach
มุมมอง 25หลายเดือนก่อน
time complexity : O(min(n,m)) [the loop will run till size of min of (m,n)] space complexity : O(1) [ no extra data structure is used] check comments for code 😀 #gfg #dailychallenge #gfgpotd #coding #geeksforgeeks #easy
Coverage of all Zeros in a Binary Matrix || GFG POTD || easy .
มุมมอง 8หลายเดือนก่อน
time complexity - O(n*m) [because of the loops] space complexity - O(1) [ no extra data structure is used] . . check comments for the solution . . #coding #dailychallenge #gfg #gfgpotd #programming #geeksforgeeks #easy
Count numbers containing 4 || GFG || POTD || 12june || easy
มุมมอง 18หลายเดือนก่อน
space comlexity-O(1) [no extra space is used] time complexity-O(nlogn) [n as we are iterating one by one to every no. and log(n) as we will iterate through the digits of a number ] check comments for code #dailychallenge #coding #gfg #potd #easy #programming
Nuts and Bolts Problem || GFG || POTD || 10th june
มุมมอง 12หลายเดือนก่อน
check comments for solution 😃 #gfg #coding #dailychallenge #cpp #c #easy #dailychallenge #gfgcoding #potd
convert array into zig-zag fashion || GFG || POTD(problem of the day || 9th june || easy
มุมมอง 24หลายเดือนก่อน
#gfg #gfgpotd #coding #easy #dailychallenge #leetcodechallenge #gfgstreek solution is in the comment section
409. Longest Palindrome || easy || Leetcode daily challenge
มุมมอง 62 หลายเดือนก่อน
#leetcode #leetcodedailychallenge #dailychallenge #coding #dailychallenges #longestpalindrome check comments for the code
2486. Append Characters to String to Make Subsequence || Leetcode medium
มุมมอง 22 หลายเดือนก่อน
#leetcode #dailycoding #dailychallenge #leetcode check comments for solution
344 Leetcode Reverse String || Problem of the day || easy
มุมมอง 42 หลายเดือนก่อน
#leetcode #coding #easy #reverseastring #dailychallenge
gfg POTD || 14 JAN || Find duplicate rows in a binary matrix || medium problem
มุมมอง 196 หลายเดือนก่อน
gfg POTD || 14 JAN || Find duplicate rows in a binary matrix || medium problem
LEETCODE 12 JAN || Determine if String Halves Are Alike || easy || #12day
มุมมอง 206 หลายเดือนก่อน
LEETCODE 12 JAN || Determine if String Halves Are Alike || easy || #12day
GFG POTD || 12 JAN || Reverse First K elements of Queue
มุมมอง 326 หลายเดือนก่อน
GFG POTD || 12 JAN || Reverse First K elements of Queue
GFG POTD || 7 JAN || LEETCODE || Split array largest sum || hard dsa problem
มุมมอง 306 หลายเดือนก่อน
GFG POTD || 7 JAN || LEETCODE || Split array largest sum || hard dsa problem

ความคิดเห็น

  • @anisha_joshi15
    @anisha_joshi15 19 วันที่ผ่านมา

    string printString(string s, char ch, int count) { // Your code goes here int cnt=0; int n=s.length(); string ans =""; for(int i=0;i<n;i++){ if(cnt>=count ){ ans += s[i]; } if(s[i]==ch)cnt++; } return ans;

  • @anisha_joshi15
    @anisha_joshi15 21 วันที่ผ่านมา

    class Solution { public: void segregate0and1(vector<int> &arr) { int n=arr.size(); int i=0; int j=n-1; while(i<j){ //1011001 //0001111 if(arr[i]==0 and arr[j]==1){ i++; j--; } else if(arr[i]==1 && arr[j]==1)j--; else if(arr[i]==0 && arr[j]==0)i++; else if(arr[i]==1 && arr[j]==0) { swap(arr[i],arr[j]); i++; j--; } } } };

  • @anisha_joshi15
    @anisha_joshi15 หลายเดือนก่อน

    class Solution { public: Node* removeAllDuplicates(struct Node* head) { map<int,int>mp; Node *temp=head; //create a map to store the occurence of the data of linked list while(temp!=NULL){ mp[temp->data]++; temp=temp->next; } Node *newHead=NULL; //to point at the head of new linked list //iterate through tha map and check for the elements having freq as 1 for(auto i:mp){ if(i.second==1){ if(newHead==NULL){ //to check whether my newhead is pointing towards any node Node *newNode=new Node(i.first); newHead=newNode; head=newNode; } else{ Node *newNode=new Node(i.first); head->next=newNode; head=newNode; } } } return newHead; } };

  • @anisha_joshi15
    @anisha_joshi15 หลายเดือนก่อน

    class Solution { public: bool compute(Node* head) { string str = ""; string copy; while(head!=NULL){ str += head->data; head= head->next; } copy=str; reverse(copy.begin(),copy.end()); if(copy==str)return true; return false; } };

  • @anisha_joshi15
    @anisha_joshi15 หลายเดือนก่อน

    Node* deleteNode(Node* head, int x) { // Your code here struct Node *temp=head; struct Node *first=head; int i=1; //deleting the first node if(x==1){ head=head->next; } //deleting the exact node given in ques else{ while(i<=x) { if(i==x){ first=temp->prev; first->next=temp->next; break; } else{ temp=temp->next; i++; } } } return head; }

  • @anisha_joshi15
    @anisha_joshi15 หลายเดือนก่อน

    bool areIdentical(struct Node *head1, struct Node *head2) { // Code here while(head1!=NULL && head2!=NULL){ if(head1->data!=head2->data){ return false; } head1=head1->next; head2=head2->next; } return head1==head2; }

  • @anisha_joshi15
    @anisha_joshi15 หลายเดือนก่อน

    class Solution { public: string pattern(vector<vector<int>> &arr) { int n = arr.size(); string ans = ""; // to check for rows for (int i = 0; i < n; i++) { string str = ""; for (int j = 0; j < n; j++) { str += to_string(arr[i][j]); } string rev = str; reverse(rev.begin(), rev.end()); if (str == rev) { ans += to_string(i) + ' ' + 'R'; return ans; } } //to check for columns for (int i = 0; i < n; i++) { string str = ""; for (int j = 0; j < n; j++) { str += to_string(arr[j][i]); // 1 1 } string rev = str; // 1 1 reverse(rev.begin(), rev.end()); // 11 if (str == rev) { ans += to_string(i) + ' ' + 'C'; return ans; } } return "-1"; } };

    • @surya.editsz
      @surya.editsz หลายเดือนก่อน

      thankyouuuu🤗🤗

  • @anisha_joshi15
    @anisha_joshi15 หลายเดือนก่อน

    bool isToepliz(vector<vector<int>>& mat) { // code here int n=mat.size();// row size int m=mat[0].size();//column size if(n==1||m==1){ //if anyone is 1 return true; } int idx; idx =min(m,n); //storing the min from row or columns size int a; a=mat[0][0];//storing the first element of diagonal int i=1; //i=1, idx=3 while(i<idx){//loop to check if all diagonal elements are equal int b; b=mat[i][i];//storing the elements of diagonal if(a!=b){ return false; } i++; } return true; }

    • @nitby27
      @nitby27 หลายเดือนก่อน

      its not working

    • @anisha_joshi15
      @anisha_joshi15 หลายเดือนก่อน

      @@nitby27 as you can see when I submitted the solution it ran properly I guess they must have introduced some changes in the question , it's common in gfg... I will provide the updated solution !

  • @anisha_joshi15
    @anisha_joshi15 หลายเดือนก่อน

    class Solution { public: int findCoverage(vector<vector<int>>& matrix) { int sum=0; int n=matrix.size(); // no of rows int m= matrix[0].size(); // no of columns for(int i=0;i<n;i++){ for(int j=0;j<m;j++) { if(matrix[i][j]==0){ if(i+1 <n && matrix[i+1][j]==1) sum += 1; if(i-1>=0 && matrix[i-1][j]==1) sum += 1; if( j-1>=0 && matrix[i][j-1]==1) sum += 1; if(j+1<m && matrix[i][j+1]==1) sum += 1; } } } return sum; } };

  • @anisha_joshi15
    @anisha_joshi15 หลายเดือนก่อน

    int countNumberswith4(int n) { // code here int count=0; int a; for(int i=1;i<=n;i++){ a=i; while(a!=0) { if(a%10==4){ count++; break; } a=a/10; } } return count; }

  • @anisha_joshi15
    @anisha_joshi15 หลายเดือนก่อน

    void matchPairs(int n, char nuts[], char bolts[]) { string s="!#$%&*?@^"; int h=0; for(int i=0;i<=9;i++){ for(int j=0;j<n;j++){ if(s[i]==nuts[j]){ //j=3 //j=2 //j=2 //j=3//j=4 swap(nuts[j],nuts[h]); //#%$@^ //#$%@^ //#$%@^ //#$%@^ //#$%@^ bolts[h]=nuts[h]; h++; //h=1 //h=2 //h=3 //h=4 //h=5 } if(h>n-1){ break; } } } }

  • @anisha_joshi15
    @anisha_joshi15 หลายเดือนก่อน

    void zigZag(int n, vector<int> &arr) { // code here for(int i =0 ;i<n-1;i++){ if(i%2==0){ if(arr[i+1]<arr[i]) swap(arr[i+1],arr[i]); } else{ if(arr[i+1]>arr[i]) swap(arr[i+1],arr[i]); } } }

  • @anisha_joshi15
    @anisha_joshi15 2 หลายเดือนก่อน

    class Solution { public: int longestPalindrome(string s) { int sum=0; int flag=0; map<char,int> palindrome; for(int i=0;i<s.length();i++){ palindrome[s[i]]++; } //a->1,b->1,c->4,d->2 for(auto it = palindrome.begin();it!=palindrome.end();++it){ if(it->second%2 == 0)sum += it->second; else{ sum += it->second-1; flag=1; } } if(flag){ sum+=1; } return sum; } };

  • @anisha_joshi15
    @anisha_joshi15 2 หลายเดือนก่อน

    class Solution { public: int appendCharacters(string s, string t) { int size_s=s.length(); int size_t=t.length(); int i=0,j=0; while(i<size_s && j<size_t){ if(s[i]==t[j]){ j++; } i++; } return size_t-j;// } };

  • @anisha_joshi15
    @anisha_joshi15 2 หลายเดือนก่อน

    class Solution { public: void reverseString(vector<char>& s) { int j= s.size()-1; int i=0; while(i<j){ swap(s[i],s[j]); i++; j--; } } };

  • @anisha_joshi15
    @anisha_joshi15 6 หลายเดือนก่อน

    class Solution { public: vector<int> repeatedRows(vector<vector<int>> &matrix, int M, int N) { vector<int>sample; vector<int> ans; for(int i=0;i<M;i++){ int deci_num=0; int k=N-1; for(int j=0;j<N;j++){ deci_num += pow(2,k)*matrix[i][j]; k--; } sample.push_back(deci_num); } for(int i=1;i<sample.size();i++){ for(int j=0;j<i;j++){ if(sample[i]==sample[j]){ ans.push_back(i); break; } } } return ans; } };

  • @anisha_joshi15
    @anisha_joshi15 6 หลายเดือนก่อน

    class Solution { public: bool halvesAreAlike(string s) { int count=0; int cnt=0; int n =s.size(); for(int i=0;i<(n/2);i++){ char a=tolower(s[i]); if(a=='a'||a=='e'|| a=='i'|| a=='o'|| a=='u')// A E I OU count++; } for(int i=n/2;i<n;i++){ char a=tolower(s[i]); if(a=='a'||a=='e'|| a=='i'|| a=='o'|| a=='u') cnt++; } if(count==cnt){ return true; } return false; } };

  • @anisha_joshi15
    @anisha_joshi15 6 หลายเดือนก่อน

    class Solution { public: queue<int> modifyQueue(queue<int> q, int k) { stack<int> s; for (int i = 0; i < k; i++) { s.push(q.front()); q.pop(); } while (!s.empty()) { q.push(s.top()); s.pop(); } for (int i = 0; i < q.size() - k; i++) { q.push(q.front()); q.pop(); } return q; } };

  • @anisha_joshi15
    @anisha_joshi15 7 หลายเดือนก่อน

    class Solution { public: int NoSubarrays(int arr[],int mid,int n){ int sum=0; int count=1; for(int i=0;i<n;i++){ if((sum+arr[i])>mid){ sum=arr[i]; count++; } else{ sum += arr[i]; } } return count; } int splitArray(int arr[] ,int n, int k)//changed n and k to lowercase { int high=0; int low =INT_MIN; int ans=0; for(int i=0;i<n;i++){ low=max(arr[i],low);//find maximum from array } for(int i=0;i<n;i++){ high += arr[i]; //find sum/high of array } while(low<=high){ int mid=(low+high)/2; int num = NoSubarrays(arr,mid,n); if(num>k){ low=mid+1; } else{ ans=mid; high=mid-1; } } return ans; } };