solution for this problem.......... #include using namespace std; #define int long long int signed main(){ int t; cin>>t; while ( t--) { int n; cin>>n; vectorv(n); for ( int i = 0; i < n; i++) { cin>>v[i]; } sort(v.begin(),v.end()); int ans=0; for ( int i = 0; i =2; i--) { ans=max(ans,v[i]-v[i-1]+v[i]-v[0]); } cout
@psurya30532 жыл бұрын
thanks paaji , tusi great ho
@EngineerPrabhatSingh2 жыл бұрын
Thanks Bhai. Support the channel.
@xolo26172 жыл бұрын
thanks sir , i was get logic from one side but never thought of to run from opposite side and now my solution(java) got accepted
@EngineerPrabhatSingh2 жыл бұрын
Thanks
@Negijicoder7 ай бұрын
maine bhi same logic lagaya tha jo phle btaya..😂😂😂😂 (kya kru hote hi nahi questions...1400 ke ab tak 60+ kr liye fir bhi atak hi jata hu..)
@ayyappaswamy82202 жыл бұрын
In the first example if we pick bricks whose weights are 1 5 2 the answer would be 7 which is greater than 6. Why shouldn't we pick 1 5 2