Count of Range Sum in C++

Arnab Chakraborty
Updated on 01-Jun-2020 10:38:21

646 Views

Suppose we have an integer array nums, we have to find the number of range sums that lie in range [lower, upper] both inclusive. The range sum S(i, j) is defined as the sum of the elements in nums from index i to index j where i ≤ j.So if the input is like [-3, 6, -1], lower = -2 and upper = 2, then the result will be 2, as the ranges are [0, 2], the sum is 2, [2, 2], sum is -2.To solve this, we will follow these steps −Define a function mergeIt(), this will take array ... Read More

Create Maximum Number in C++

Arnab Chakraborty
Updated on 01-Jun-2020 10:35:46

268 Views

Suppose we have two arrays of length m and n with digits 0-9 representing two numbers. We have to create the maximum number of length k that is less than m + n from digits of the two. We have to keep in mind that the relative order of the digits from the same array must be preserved. We have to find the array of the k digits. So if the inputs are like [3, 4, 7, 5] and [9, 1, 3, 5, 8, 4], and k = 5, then the answer will be [9, 8, 7, 5, 4].To solve ... Read More

Specify Target for Linked Document in HTML

vanithasree
Updated on 01-Jun-2020 09:26:06

225 Views

Use the target attribute to specify the target for where to open the linked document in HTML. Here are the values of the target attribute −AttributeDescription_blankOpens the linked page in a new tab.selfOpens the linked page in the current tab.parentOpens the linked page in a parent frame.topOpens the linked page in the topmost frame.ExampleYou can try to run the following code to implement target attribute −           HTML target attribute               References       Refer the following website.          The above link will open in a new tab.    

Specify Content Translation in HTML

Krantik Chavan
Updated on 01-Jun-2020 09:25:06

174 Views

The translate attribute is useful to set that the content of an element is to be translated or not.The following are the attributes −AttributeValueDescriptionYesThe content should be translated.NoThe content should not be translated.If you did not want a specific word to be translated, then add it to the translate attribute −This won’t get translated.

Specify Number of Visible Options for Select in HTML

varma
Updated on 01-Jun-2020 08:56:00

109 Views

Use the size attribute to set the number of visible options for element in HTML.ExampleYou can try to run the following code to implement size attribute −           Select the countries you have visited till now,                India          US          Canada          Australia          Bangladesh          

Set Number of Rows a Table Cell Should Span in HTML

Vrundesha Joshi
Updated on 01-Jun-2020 08:50:05

3K+ Views

Use the rowspan attribute to set the number of rows a table cell should span. To merge cells in HTML, use the colspan and rowspan attribute. The rowspan attribute is for number of rows a cell should span, whereas the colspan attribute is for number of columns a cell should span.Example                    table, th, td {             border: 1px solid black;             width: 100px;             height: 50px;          }                     Heading                                                                                                                                                                

Enable Extra Restrictions for Content in an Iframe in HTML

Giri Raju
Updated on 01-Jun-2020 08:49:32

36 Views

Use the sandbox attribute to enable an extra set of restrictions for the content in an in HTML.ExampleYou can try to run the following code to implement sandbox attribute −                    Your browser does not support iframes.          

Display Short Hint for Expected Value in HTML

Daniol Thomas
Updated on 31-May-2020 00:27:36

336 Views

Use the placeholder attribute in HTML to display a hint describing the expected value of the element.ExampleYou can try to run the following code to implement placeholder attribute −           Login                                              

Execute a Script When an Element is Dragged to a Valid Drop Target in HTML

varma
Updated on 31-May-2020 00:20:20

139 Views

When an element has been dragged in HTML to a valid drop target, the ondragenter attribute fires.ExampleYou can try to run the following code to implement the ondragenter attribute −                    #boxA, #boxB {             float:left;padding:10px;margin:10px; -moz-user-select:none;          }          #boxA { background-color: #6633FF; width:75px; height:75px; }          #boxB { background-color: #FF6699; width:150px; height:150px; }                      function dragStart(ev) {             ev.dataTransfer.effectAllowed = 'move';             ev.dataTransfer.setData("Text", ev.target.getAttribute('id'));             ev.dataTransfer.setDragImage(ev.target,0,0);             return true;          }                              Drag and drop HTML5 demo          Try to drag the purple box around.                       Drag Me                    Dustbin          

Specify Multiple Values in HTML

Nishtha Thakur
Updated on 31-May-2020 00:19:32

179 Views

Use the multiple attribute in HTML to specify a user can enter more than one value.ExampleYou can try to run the following code to implement multiple attribute −           Upload multiple files                                  After uploading multiple files, click Submit.                    

Advertisements