File size: 16,356 Bytes
7f8e190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
{% extends "base.html" %}
{% import "_partials.html" as ui %}
{# Structure, ordering and copy follow problemset-desktop / problemset-mobile:
   left library rail, promo carousel, topic strip, category tabs, the search /
   sort / filter row, the row list, and the right rail. #}
{% block title %}Problems - LeetCode{% endblock %}
{% block header %}{{ ui.app_header(member, 'problems') }}{% endblock %}
{% block main %}
<div class="ps">
  <aside class="ps__rail" aria-label="Library">
    <button class="ps-rail__toggle" type="button" data-rail-toggle aria-expanded="true" aria-label="Collapse library sidebar">
      <span aria-hidden="true">&lsaquo;</span>
    </button>
    <ul class="ps-lib">
      <li><a class="ps-lib__link is-active" href="/problemset/"><span class="ps-lib__icon" aria-hidden="true"><svg viewBox="0 0 20 20" width="18" height="18" focusable="false"><path d="M3 4h4v12H3zM8.5 4h3v12h-3zM13.4 4.6l3.1.8-2.6 11.2-3.1-.8z" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/></svg></span><span class="ps-lib__label">Library</span></a></li>
      <li><a class="ps-lib__link" href="/quest/"><span class="ps-lib__icon" aria-hidden="true"><svg viewBox="0 0 20 20" width="18" height="18" focusable="false"><path d="m3 3 6.5 6.5M17 3l-6.5 6.5M10 10l-3.5 7M10 10l3.5 7" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg></span><span class="ps-lib__label">Quest</span></a></li>
      <li><a class="ps-lib__link" href="/explore/"><span class="ps-lib__icon" aria-hidden="true"><svg viewBox="0 0 20 20" width="18" height="18" focusable="false"><rect x="3" y="4" width="14" height="12" rx="2" fill="none" stroke="currentColor" stroke-width="1.4"/><path d="M7 4v12" stroke="currentColor" stroke-width="1.4"/></svg></span><span class="ps-lib__label">Explore</span></a></li>
      <li><a class="ps-lib__link" href="/studyplan/"><span class="ps-lib__icon" aria-hidden="true"><svg viewBox="0 0 20 20" width="18" height="18" focusable="false"><path d="M3 5.5 10 3l7 2.5v9L10 17l-7-2.5Z" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/><path d="M10 3v14" stroke="currentColor" stroke-width="1.4"/></svg></span><span class="ps-lib__label">Study Plan</span></a></li>
    </ul>
    <hr class="ps-rule">
    {% if member %}
    <p class="ps-rail__note">Signed in as <strong>{{ member.username }}</strong>.</p>
    <p class="ps-rail__progress"><strong data-solved-count>{{ page.solved }}</strong> of {{ page.catalogue_total }} solved</p>
    <div class="ps-rail__bar" role="img" aria-label="{{ solved_percent }} percent solved"><span style="width: {{ solved_percent }}%"></span></div>
    <a class="ps-rail__link" href="/progress/">View progress</a>
    {% else %}
    <p class="ps-rail__note">Sign in to view lists and track study progress.</p>
    <a class="ps-rail__signin" href="/accounts/login/">
      <span class="ps-rail__avatar" aria-hidden="true"><svg viewBox="0 0 16 16" width="14" height="14" focusable="false"><circle cx="8" cy="6" r="2.6" fill="currentColor"/><path d="M3 13.4c0-2.4 2.2-3.6 5-3.6s5 1.2 5 3.6Z" fill="currentColor"/></svg></span>
      Sign in
    </a>
    {% endif %}
  </aside>

  <section class="ps__main">
    <div class="ps-promos" aria-label="Featured">
      <a class="ps-promo ps-promo--dark" href="/app/">
        <span class="ps-promo__logo" aria-hidden="true">{{ ui.logo_mark(22) }}</span>
        <span class="ps-promo__title">LeetCode at Your Fingertips</span>
      </a>
      <a class="ps-promo ps-promo--green" href="/explore/">
        <span class="ps-promo__title">LeetCode's Interview Crash Course:</span>
        <span class="ps-promo__sub">System Design for Interviews and Beyond</span>
      </a>
      <a class="ps-promo ps-promo--purple" href="/explore/">
        <span class="ps-promo__title">LeetCode's Interview Crash Course:</span>
        <span class="ps-promo__sub">Data Structures and Algorithms</span>
      </a>
      <a class="ps-promo ps-promo--blue" href="/studyplan/">
        <span class="ps-promo__title">Top Interview 150</span>
        <span class="ps-promo__sub">Must-do questions for interview prep</span>
      </a>
    </div>

    <nav class="ps-topics{% if topics_expanded %} is-expanded{% endif %}" aria-label="Topics" data-topic-strip>
      <ul class="ps-topics__list">
        {% for topic, count in topics %}
        <li>
          <a class="ps-topic{% if topic in query.topics %} is-active{% endif %}"
             href="{{ query.url(topics=(query.topics|reject('equalto', topic)|list if topic in query.topics else query.topics|list + [topic]), page=1) }}">
            {{ topic }}<span class="ps-topic__count">{{ count }}</span>
          </a>
        </li>
        {% endfor %}
      </ul>
      <button class="ps-topics__expand" type="button" data-topic-expand aria-expanded="false">
        Expand<span class="caret caret--double" aria-hidden="true"></span>
      </button>
    </nav>

    <nav class="ps-tabs" aria-label="Question categories">
      {% for slug, label in categories %}
      <a class="ps-tab{% if slug == query.category %} is-active{% endif %}"
         href="{{ query.url(category=slug, page=1) }}">
        <span class="ps-tab__icon" aria-hidden="true"></span>{{ label }}
      </a>
      {% endfor %}
    </nav>

    <form class="ps-controls" method="get" action="{{ query.path() }}" role="search" data-controls>
      {% for topic in query.topics %}<input type="hidden" name="topic" value="{{ topic }}">{% endfor %}
      <label class="ps-search">
        <span class="visually-hidden">Search questions</span>
        <svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false"><circle cx="7" cy="7" r="5" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="m11 11 3.4 3.4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>
        <input type="search" name="search" value="{{ query.search }}" placeholder="Search questions" autocomplete="off">
      </label>

      <details class="ps-pop" data-pop>
        <summary class="ps-round{% if query.sort != 'custom' or query.order %} is-set{% endif %}" aria-label="Sort">
          <svg viewBox="0 0 16 16" width="15" height="15" aria-hidden="true" focusable="false"><path d="M4.5 2.5v11M4.5 13.5 2 11M11.5 13.5v-11M11.5 2.5 14 5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
        </summary>
        <div class="ps-pop__panel">
          <p class="ps-pop__title">Sort by</p>
          <ul class="ps-pop__list">
            {% for value, label in sort_options %}
            <li><a class="ps-pop__item{% if value == query.sort %} is-active{% endif %}" href="{{ query.url(sort=value, order='', page=1) }}">{{ label }}</a></li>
            {% endfor %}
          </ul>
          <p class="ps-pop__title">Direction</p>
          <ul class="ps-pop__list ps-pop__list--row">
            <li><a class="ps-pop__item{% if not query.order %} is-active{% endif %}" href="{{ query.url(order='', page=1) }}">Default</a></li>
            <li><a class="ps-pop__item{% if query.order == 'asc' %} is-active{% endif %}" href="{{ query.url(order='asc', page=1) }}">Ascending</a></li>
            <li><a class="ps-pop__item{% if query.order == 'desc' %} is-active{% endif %}" href="{{ query.url(order='desc', page=1) }}">Descending</a></li>
          </ul>
        </div>
      </details>

      <details class="ps-pop" data-pop>
        <summary class="ps-round{% if query.difficulty or query.status or query.topics or query.language %} is-set{% endif %}" aria-label="Filter">
          <svg viewBox="0 0 16 16" width="15" height="15" aria-hidden="true" focusable="false"><path d="M2 3h12l-4.6 5.4v4.3l-2.8 1.4V8.4Z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>
          {% if query.difficulty or query.status or query.topics or query.language %}<span class="ps-round__dot" aria-hidden="true"></span>{% endif %}
        </summary>
        <div class="ps-pop__panel ps-pop__panel--wide">
          <p class="ps-pop__title">Status</p>
          <ul class="ps-pop__list ps-pop__list--row">
            {% for value, label in status_options %}
            <li><a class="ps-pop__item{% if value == query.status %} is-active{% endif %}" href="{{ query.url(status=value, page=1) }}">{{ label if value else 'Any' }}</a></li>
            {% endfor %}
          </ul>
          <p class="ps-pop__title">Difficulty</p>
          <ul class="ps-pop__list ps-pop__list--row">
            {% for value, label in difficulty_options %}
            <li><a class="ps-pop__item{% if value == query.difficulty %} is-active{% endif %}" href="{{ query.url(difficulty=value, page=1) }}">{{ label if value else 'Any' }}</a></li>
            {% endfor %}
          </ul>
          <p class="ps-pop__title">Language</p>
          <ul class="ps-pop__list ps-pop__list--row">
            <li><a class="ps-pop__item{% if not query.language %} is-active{% endif %}" href="{{ query.url(language='', page=1) }}">Any</a></li>
            {% for value in all_languages %}
            <li><a class="ps-pop__item{% if value == query.language %} is-active{% endif %}" href="{{ query.url(language=value, page=1) }}">{{ value|language_label }}</a></li>
            {% endfor %}
          </ul>
          {% if query.is_filtered %}
          <p class="ps-pop__reset"><a href="{{ query.path() }}">Reset all filters</a></p>
          {% endif %}
        </div>
      </details>

      <noscript><button class="ps-apply" type="submit">Search</button></noscript>

      <p class="ps-solved" data-result-summary>
        <span class="ps-solved__ring" aria-hidden="true"></span>
        <a href="/progress/">{{ page.solved }}/{{ page.catalogue_total }} Solved</a>
      </p>
      <a class="ps-round ps-round--plain" href="{{ random_url }}" aria-label="Pick one">
        <svg viewBox="0 0 16 16" width="15" height="15" aria-hidden="true" focusable="false"><path d="M2 4h2.6l6.8 8H14M2 12h2.6l6.8-8H14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/><path d="m12 2.4 2 1.6-2 1.6M12 10.4l2 1.6-2 1.6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
      </a>
    </form>

    {% if query.is_filtered %}
    <p class="ps-summary">
      {% if page.is_empty %}
      No questions match these filters.
      {% else %}
      Showing {{ page.start_index }}&ndash;{{ page.end_index }} of {{ page.total }} questions.
      {% endif %}
      <a href="{{ query.path() }}">Clear</a>
    </p>
    {% endif %}

    {% if page.is_empty %}
    <div class="ps-empty">
      <p class="ps-empty__title">No results</p>
      <p>Nothing matches the current search and filters.</p>
      <a class="ps-empty__reset" href="{{ query.path() }}">Reset filters</a>
    </div>
    {% else %}
    <ol class="ps-rows" data-rows>
      {% for row in page.rows %}
      <li class="ps-row{% if loop.index is odd %} ps-row--tint{% endif %}" data-question="{{ row.slug }}">
        <a class="ps-row__link" href="/problems/{{ row.slug }}/description/">
          <span class="ps-row__lead">
            {% if row.is_daily %}
            <span class="ps-row__daily" title="Daily question" role="img" aria-label="Daily question">
              <svg viewBox="0 0 16 16" width="15" height="15" focusable="false"><rect x="2" y="3" width="12" height="11" rx="2" fill="none" stroke="currentColor" stroke-width="1.4"/><path d="M2 6.4h12M5.4 2v2.6M10.6 2v2.6" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg>
            </span>
            {% else %}
            {{ ui.status_icon(row.status) }}
            {% endif %}
            <span class="ps-row__title">{{ row.number }}. {{ row.title }}</span>
          </span>
          <span class="ps-row__acceptance">{{ '%.1f'|format(row.acceptance) }}%</span>
          <span class="ps-row__difficulty ps-row__difficulty--{{ row.difficulty|lower }}">{{ row.difficulty|difficulty_label }}</span>
          <span class="ps-row__frequency">{{ ui.frequency_lock() }}</span>
        </a>
      </li>
      {% endfor %}
    </ol>

    {% if page.pages > 1 %}
    <nav class="ps-pager" aria-label="Pagination">
      {% if page.page > 1 %}
      <a class="ps-pager__step" href="{{ query.url(page=page.page - 1) }}" rel="prev" aria-label="Previous page">&lsaquo;</a>
      {% else %}
      <span class="ps-pager__step is-disabled" aria-hidden="true">&lsaquo;</span>
      {% endif %}
      {% for number in page_numbers %}
      <a class="ps-pager__page{% if number == page.page %} is-current{% endif %}"
         href="{{ query.url(page=number) }}"{% if number == page.page %} aria-current="page"{% endif %}>{{ number }}</a>
      {% endfor %}
      {% if page.page < page.pages %}
      <a class="ps-pager__step" href="{{ query.url(page=page.page + 1) }}" rel="next" aria-label="Next page">&rsaquo;</a>
      {% else %}
      <span class="ps-pager__step is-disabled" aria-hidden="true">&rsaquo;</span>
      {% endif %}
    </nav>
    {% endif %}
    {% endif %}
  </section>

  <aside class="ps__aside" aria-label="Daily and companies">
    <section class="ps-card ps-calendar">
      <header class="ps-calendar__head">
        <p class="ps-calendar__day">Day {{ calendar.today }}<span class="ps-calendar__left" data-countdown data-deadline="{{ calendar.midnight }}">{{ calendar.remaining }} left</span></p>
        <div class="ps-calendar__nav" aria-hidden="true"><span>&lsaquo;</span><span>&rsaquo;</span></div>
      </header>
      <table class="ps-calendar__grid">
        <caption class="visually-hidden">{{ calendar.month_label }}</caption>
        <thead><tr>{% for label in calendar.weekday_labels %}<th scope="col">{{ label }}</th>{% endfor %}</tr></thead>
        <tbody>
          {% for week in calendar.weeks %}
          <tr>
            {% for day in week %}
            <td>{% if day %}<span class="ps-calendar__cell{% if day == calendar.today %} is-today{% endif %}">{{ day }}</span>{% endif %}</td>
            {% endfor %}
          </tr>
          {% endfor %}
        </tbody>
      </table>
    </section>

    <section class="ps-card ps-weekly">
      <header class="ps-weekly__head">
        <span class="ps-weekly__title">Weekly Premium</span>
        <span class="ps-weekly__left">{{ calendar.weekly_left }}</span>
      </header>
      <ol class="ps-weekly__slots">
        {% for slot in calendar.weekly_slots %}
        <li class="ps-weekly__slot{% if slot.active %} is-active{% endif %}">{{ slot.label }}</li>
        {% endfor %}
      </ol>
      <footer class="ps-weekly__foot">
        <span class="ps-weekly__coins">0</span>
        <a href="/store/">Redeem</a>
        <a class="ps-weekly__rules" href="/store/">Rules</a>
      </footer>
    </section>

    <section class="ps-card ps-companies">
      <header class="ps-companies__head">
        <h2>Trending Companies</h2>
        <div class="ps-companies__nav">
          <button type="button" data-company-prev aria-label="Previous companies">&lsaquo;</button>
          <button type="button" data-company-next aria-label="More companies">&rsaquo;</button>
        </div>
      </header>
      <label class="ps-companies__search">
        <span class="visually-hidden">Search for a company</span>
        <svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true" focusable="false"><circle cx="7" cy="7" r="5" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="m11 11 3.4 3.4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>
        <input type="search" placeholder="Search for a company..." autocomplete="off" data-company-search>
      </label>
      <ul class="ps-companies__list" data-company-list>
        {% for company in companies %}
        <li data-page="{{ loop.index0 // 28 }}"{% if loop.index0 >= 28 %} hidden{% endif %}>
          <a class="ps-company" href="/problemset/?search={{ company.name|urlencode }}">
            {{ company.name }}<span class="ps-company__count">{{ company.count }}</span>
          </a>
        </li>
        {% endfor %}
      </ul>
    </section>
  </aside>
</div>
{% endblock %}
{% block footer %}{{ ui.app_footer('white') }}{% endblock %}
{% block scripts %}<script src="/static/js/problemset.js" defer></script>{% endblock %}