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
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
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.
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.
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
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
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.
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
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
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.
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP