fenil Posted September 29, 2021 Share Posted September 29, 2021 Given N = 4, A = [1, 3], B = [2, 4] function should return 10. The graph contains two edges: (1, 2) and (3, 4). function ec($n, array $a, array $b){ } Link to comment https://forums.phpfreaks.com/topic/313834-edges-and-vertices/ Share on other sites More sharing options...
gw1500se Posted September 29, 2021 Share Posted September 29, 2021 Is there a question in there somewhere or are you asking someone to program it for you. If the latter then you need to post it here. Link to comment https://forums.phpfreaks.com/topic/313834-edges-and-vertices/#findComment-1590527 Share on other sites More sharing options...
Barand Posted September 29, 2021 Share Posted September 29, 2021 (edited) Here you are. Now it returns 10 function ec($n, array $a, array $b){ return 10; } We are not going to do your assignment for you. Edited September 29, 2021 by Barand 1 Link to comment https://forums.phpfreaks.com/topic/313834-edges-and-vertices/#findComment-1590528 Share on other sites More sharing options...
Solution fenil Posted September 30, 2021 Author Solution Share Posted September 30, 2021 (edited) 14 hours ago, Barand said: Here you are. Now it returns 10 function ec($n, array $a, array $b){ return 10; } We are not going to do your assignment for you. Given N = 4, A = [1, 3], B = [2, 4] function should return 10. The graph contains two edges: (1, 2) and (3, 4). We can assign following values to the vertices: 4, 3, 2, 1. The sum of values at the edges' endpoints is (4 + 3) + (2 + 1) = 10. how to find edges of vertices and sum of values at the edges' endpoints ? function ec($n, array $a, array $b){ } Edited September 30, 2021 by fenil Link to comment https://forums.phpfreaks.com/topic/313834-edges-and-vertices/#findComment-1590545 Share on other sites More sharing options...
Recommended Posts