mistake in description - faster than 100% - fully explained w/ comments
About the description :\n\nI realise that the description is not framed correctly!\nI know it is technically correct but it would be better if the wording could
**About the description :**\n\nI realise that the description is not framed correctly!\nI know it is technically correct but it would be better if the wording could be modified a little.\n```\nGiven an integer k, return the maximum star sum of a star graph containing at most k edges.\n\n```\nThis made me think we consider only nodes having at most k edges. When it was supposed to mean we consider at most k edges.\n\nSo maybe it can be changed to : \n```\nGiven an integer k, return the maximum star sum of a star graph by considering at most k of its edges.\n```\n\n**Approach :**\n\nThe basic aproach is GREEDY, as we would like to only pick those nodes adjacent to our focal-node(centre of the star), which can help us increase the value of out "starSum". \nWe do that by using a MAX HEAP as we insert the values of all the adjNode of our focal-node, and add to the sum only the top k values from the max heap (if they increase the overall \'StarSum\').\n\nPlease refer the code for full understanding!\nPlease UPVOTE if this helps you, or if u think it can help others!\nDiscussions in comments are welcome, CHEERS!\n\n\n# Code\n```\nclass Solution {\npublic:\n\n    int starsum(int node, vector<int> adj[], vector<int>& val, int k){\n        \n        // atmost k edges/nodes to take\n        priority_queue<int> pq;\n        int sum = val[node]; // as the focal node of the star has to be included\n        int prev = sum;\n\n        for(auto it: adj[node]){\n            pq.push(val[it]); //pushing all values of adjNodes of \'currentNode\' into MAX-HEAP\n        }\n\n        int cnt=0; //cnt of nodes taken into summation\n\n        while(!pq.empty()){\n\n             if(cnt==k) break;\n            // if u pick a node, then do cnt++; \n            int n = pq.top();\n            pq.pop();\n\n            sum = sum + n;\n            if(sum>prev){\n                cnt++;\n                prev = sum;\n            }\n            else if(sum<=prev){ \n                sum = prev; //again resetting sum to its prev value as the new node actually decrased its value\n            }\n        }\n\n        return sum;\n    }\n\n    int maxStarSum(vector<int>& val, vector<vector<int>>& edges, int k) {\n        // 0 indexed graph   \n        //undirected\n        // star graph : subset of edges of the given graph such that there exists a common node for all edges.\n        \n        int n = val.size();\n        if(n==1) return val[0];  //refer example test cases for n==1 case.\n\n        vector<int> adj[n];  // making adj list that stores adjNodes of a given node\n        for(auto it: edges){\n            adj[it[0]].push_back(it[1]);\n            adj[it[1]].push_back(it[0]);\n        }\n\n        int maxStarSum = -1e9;\n\n        for(int i=0; i<n; i++){\n            maxStarSum = max( maxStarSum, starsum(i,adj,val,k));\n        }\n\n        return maxStarSum;\n    }\n};\n```
['Greedy', 'C++']