leetcode solutions

0001 Two sum 1 2 3 4 5 6 7 8 9 10 class Solution(object): def twoSum(self, nums, target): if len(nums) <= 1: return False buff_dict = {} for i in range(len(nums)): if nums[i] in buff_dict: return [buff_dict[nums[i]], i] else: buff_dict[target - nums[i]] = i 0002 Add Two Numbers 1 2 3 4 5 6 7 8 9 10 11 12 13 14 def addTwoNumbers(self, l1, l2): dummy = cur = ListNode(0) carry = 0 while l1 or l2 or carry: if l1: carry += l1.

jQuery Tutorial

jQuery Get Started Downloading jQuery 1 2 3 <head> <script src="jquery-3.3.1.min.js"></script> </head> jQuery CDN 1 2 3 <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> </head> 1 2 3 <head> <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script> </head> jQuery Syntax Basic syntax is: $(selector).action() 1 2 3 4 5 // Examples: $(this).hide() // hides the current element. $("p").hide() // hides all <p> elements. $(".test").hide() // hides all elements with class="test". $("#test").hide() // hides the element with id="test". 1 2 3

DOM

所有 HTML 元素被定义为对象,而编程接口则是对象方法和对象属性。 方法是您能够执行的动作(比如添加或修改元素)。 属性是您能够获取或设置的值(比如节点

Getting started with the Web

Naming name folders and files completely in lowercase with no spaces. This is because: Many computers, particularly web servers, are case-sensitive. Browsers, web servers, and programming languages do not handle spaces consistently. It’s better to separate words with dashes, rather than underscores: my-file.html vs. my_file.html. The short answer is that you should use a hyphen for your file names. The Google search engine treats a hyphen as a word separator but does not regard an underscore that way.

browser cache

浏览器缓存机制 浏览器缓存机制,其实主要就是HTTP协议定义的缓存机制(如: Expires****; Cache-control****等)。但

CSS

CSS first steps CSS can be used for very basic document text styling, it can be used to create a layout. Using the browser compatibility table to check how this property is supported across various browsers. CSS syntax 1 2 3 css-selector { property: value; } Comments CSS comments begin with /* and end with */. Comments helps to navigate the codebase as it gets larger. “Commenting out” code is

HTML

Introduction to HTML Getting started with HTML What is HTML? HTML (Hypertext Markup Language) is not a programming language; it is a markup language used to tell your browser how to structure the web pages you visit. HTML consists of a series of elements, an element may contain a data item or a chunk of text or an image, or perhaps nothing. A typical element includes an opening tag with

learning path for computer science

Quarter 1 Quarter 2 Quarter 3 Freshman Math 19: Calculus Math 20: Calculus Math 21: Calculus CS 106A: Programming Methodology CS 106B: Programming Abstractions Phys 21: Mechanics Sophomore Math 51: Linear Algebra Math 52: Integral Calculus of Several Variables Math 53: Differential Equations with Linear Algebra Phys 23: Electricity ENG 40 CS 109: Introduction to Probability for Computer Scientists CS 107: Computer Organization and Systems CS 103: Mathematical Foundations of

Learning Python

The most important question to answer first is why do I want to learn python? Answering this will guide what you use to learn and how you learn. Starting with a very generic list of resources to learn python when you eventually want to make websites (for example), will not only reduce your motivation, it will also make it much harder to apply the knowledge you gain. I’ve tried to learn coding without context and application, and I’ve almost never come out of it with any meaningful skills.

面试技巧 👂倾听 面试开始前:保持冷静,专注于面试官的问题和指示;一般开始前面试官会cue整体面试的流程,深呼吸,然后按指示展开交流 面试过程中:

Database partitioning guidance general guidance about when to partition data and best practices. Comparison of database sharding and partitioning Database sharding is like horizontal partitioning. Both processes split the database into multiple groups of unique rows. Partitioning stores all data groups in the same computer, but database sharding spreads them across different computers. Why partition data? Improve scalability. When you scale up a single database system, it will eventually reach

Domain-driven design The DDD patterns presented in this guide should not be applied universally. They introduce constraints on your design. Those constraints provide benefits such as higher quality over time, especially in commands and other code that modifies system state. However, those constraints add complexity with fewer benefits for reading and querying data. Steps to Learn Domain-driven Design Understand the Principles: Start by familiarizing yourself with the core principles of DDD, such as domain modeling, ubiquitous language, and bounded contexts.

Event-driven architecture Event-driven architectures often being designed atop message-driven architectures, An event can be defined as “a significant change in state”. An event-driven architecture consists of event producers that generate a stream of events, event consumers that listen for the events, and event channels. Event structure An event is often used metonymically to denote the notification message itself, which may lead to some confusion. An event can be made of two parts, the event header and the event body.