Comments

wow nice! but i have a dumb doubt in finding maximum independent set of each connected component.for each component can we just color a node with red and the adjacency list with blue and its adjacency list with red....now we can count how many are colored in red and blue and the max of no of blue and red isn't maximum independent set?I found there exist algo to do it so i am sure i am wrong.could u tell where i was wrong(i could'nt find counter example)

my friend ,i am practicing ,i did not ask how to practice,read correctly before saying something(no offense).due to you many people downvoted this and i did not my answer to my genuine question

Auto comment: topic has been updated by electro177 (previous revision, new revision, compare).

No one got?

Auto comment: topic has been updated by electro177 (previous revision, new revision, compare).

On electro177 → Good dp Question, 5 years ago
-6

Dude ,this is from a company test,I could not get this while solving,so asking

On focus_on_cp → Coding test problems, 5 years ago
0

How to solve Third problem?I thought of it for long time but did not get ideas.In a classical knapsack problem we find maximum sum of values, but here for a given sum there can be various possiblities (but which to choose),i am clueless ,some one please please please give idea and code if possible:)

On electro177 → Doubts in questions, 5 years ago
0

anyone knows 2nd one :')

On electro177 → Doubts in questions, 5 years ago
0

Some one please help,this is not any ongoing stuff

for this problem ~~~~~

define all(x) (x).begin(), (x).end()

vector<vector> ans; int n; class Solution {

public:
void solve(int index ,int target ,vector<int>& candidates,vector<int> &ds){

    if(index==n){

        if(target==0){
            vector<int> temp=ds;
             sort(all(temp));
            ans.push_back(temp);
        }
        return;
    }

    if(target>=candidates[index]){
        ds.push_back(candidates[index]);

        solve(index+1,target-candidates[index],candidates,ds);
        ds.pop_back();

    }

     solve(index+1,target,candidates,ds);
}


public:
vector<vector<int>> combinationSum2(vector<int>& candidates, int target) {
   sort(all(candidates));         
  ans.clear(); 
    n=target;
    vector<int> ds;
    solve(0,target,candidates,ds);
    sort(all(ans));

ans.resize(unique(all(ans)) — ans.begin()); return ans; }

}; ~~~~~ for this problem i did that and it worked on a test case but gave runtime error for other test

~~~~~

==29==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000007d4 at pc 0x000000348638 bp 0x7fffa9e75030 sp 0x7fffa9e75028 READ of size 4 at 0x6020000007d4 thread T0 #4 0x7fb195bd70b2 (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) 0x6020000007d4 is located 0 bytes to the right of 4-byte region [0x6020000007d0,0x6020000007d4) allocated by thread T0 here: #6 0x7fb195bd70b2 (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) Shadow bytes around the buggy address: 0x0c047fff80a0: fa fa fd fa fa fa fd fa fa fa fd fd fa fa fd fa 0x0c047fff80b0: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa 0x0c047fff80c0: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa 0x0c047fff80d0: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa 0x0c047fff80e0: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa =>0x0c047fff80f0: fa fa fd fa fa fa fd fa fa fa[04]fa fa fa 04 fa 0x0c047fff8100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8110: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8120: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8130: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8140: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc ==29==ABORTING

~~~~~

Auto comment: topic has been updated by electro177 (previous revision, new revision, compare).

-10

Auto comment: topic has been updated by electro177 (previous revision, new revision, compare).

On electro177 → Help in dp problem, 5 years ago
0

what is the transition in this question ,why are we going from s+w to s for every block

On electro177 → Help in dp problem, 5 years ago
0

Auto comment: topic has been updated by electro177 (previous revision, new revision, compare).

On electro177 → sublime text problem, 5 years ago
0

Dude instead of downvotes ,anyone please help

On electro177 → sublime text problem, 5 years ago
0

Auto comment: topic has been updated by electro177 (previous revision, new revision, compare).

Auto comment: topic has been updated by electro177 (previous revision, new revision, compare).

Auto comment: topic has been updated by electro177 (previous revision, new revision, compare).

On electro177 → runtime error, 5 years ago
0

I defined ll as long long first and then did the rep for for loop but it is still giving runtime error

On Yukuk → Do you play computer games?, 6 years ago
0

Fifa mobile

Auto comment: topic has been updated by electro177 (previous revision, new revision, compare).

On electro177 → Addiction to something, 6 years ago
0

wtf this is real and ya help

thank u for all suggestions.i will do my level best

Please help

Auto comment: topic has been updated by electro177 (previous revision, new revision, compare).

Auto comment: topic has been updated by electro177 (previous revision, new revision, compare).

Bro, coach me also