Question: Here's [the question from leetcode](https://oj.leetcode.com/problems/largest-number/)

> 
> Given a list of non negative integers, arrange them such that they
>  form the largest number.
> 
> 
> For example, given [3, 30, 34, 5, 9], the largest formed number is
>  9534330.
> 
> 
> 

Here's the simplest solution I've ever seen:

```
class Solution {
public:
    string largestNumber(vector<int> &num) {
        vector<string> arr;
        for(auto i:num)
            arr.push_back(to_string(i));
        sort(begin(arr), end(arr), [](string &s1, string &s2){ return s1+s2>s2+s1; });
        string res;
        for(auto s:arr)
            res+=s;
        while(res[0]=='0' && res.length()>1)
            res.erase(0,1);
        return  res;
    }
};

```

I am so confused that why this method works..Could anybody give a prove to this method?

Answer: 
You need to add an onclick event to the image, and use it to call a javascript function. Within that, check to see if the first checkbox is checked, and if it is, check the second one.
Info on onclick: <http://www.w3schools.com/jsref/event_onclick.asp>

```
<img src="yourimage.jpg" onclick="checkthebox()">

```

Pseudocode for the function:

```
function checkthebox(){
if(document.form.one.checked == false) {
document.form.one.checked = true;
}
else document.form.two.checked = true;
}

```

You will need to edit the code so that the function targets your actual checkboxes, and not these named "one" and "two"
Try this event it will work.

```
$( "#target" ).dblclick(function() { 
    alert( "Handler for .dblclick() called." ); 
});

```