feat: example problem article
This commit is contained in:
parent
124d91f811
commit
5e43af637e
1 changed files with 27 additions and 29 deletions
|
|
@ -4,37 +4,35 @@
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<link
|
<link rel="stylesheet" href="styles.css" />
|
||||||
rel="stylesheet"
|
<title>Problems - Sliding Window</title>
|
||||||
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"
|
|
||||||
/>
|
|
||||||
<title>Barrett Ruth</title>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
nothing here for now :)
|
<h1>Trapping the Rainwaters</h1>
|
||||||
|
<p>Trapping Raintwaters Leetcode Problem Description</p>
|
||||||
|
<p>
|
||||||
|
Example: Finding the maximum sum subarray of a fixed size.
|
||||||
|
</p>
|
||||||
|
<pre class="sliding-window-algorithm">
|
||||||
|
</pre>
|
||||||
|
<h2>Topic Relevance</h2>
|
||||||
|
<p>
|
||||||
|
The sliding window algorithm is widely used in software development for solving optimization problems, especially when dealing with arrays or lists. It's useful in scenarios where you need to track a subset of data within a larger dataset efficiently, making it a crucial tool in fields like data analysis, machine learning, and others.
|
||||||
|
</p>
|
||||||
</body>
|
</body>
|
||||||
|
<script>
|
||||||
<style type="text/css">
|
document.querySelector('.sliding-window-algorithm').innerText =
|
||||||
@font-face {
|
String.raw`
|
||||||
font-family: et-book;
|
int trap(vector<int>& height) {
|
||||||
src: url(et-book.ttf);
|
auto l = height.begin(), r = height.end() - 1;
|
||||||
|
int level = 0, water = 0;
|
||||||
|
while (l != r + 1) {
|
||||||
|
int lower = *l < *r ? *l++ : *r--;
|
||||||
|
level = max(level, lower);
|
||||||
|
water += level - lower;
|
||||||
}
|
}
|
||||||
|
return water;
|
||||||
body {
|
}
|
||||||
font-family: et-book;
|
`
|
||||||
font-size: 1.5em;
|
</script>
|
||||||
background-color: #f9f5d7;
|
|
||||||
margin: 100px auto;
|
|
||||||
max-width: 650px;
|
|
||||||
scroll-behavior: smooth;
|
|
||||||
overscroll-behavior-y: none;
|
|
||||||
overscroll-behavior-x: none;
|
|
||||||
}
|
|
||||||
body,
|
|
||||||
html {
|
|
||||||
overflow-anchor: none;
|
|
||||||
padding: 0 5%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue