杭州银行 笔试彻底凉了...
📍 笔试公司:杭州银行
💻 笔试岗位:科技岗
📚 笔试问题:
计算机基础+1道sql题+1道Python题+数据分析题+日常情况了解。
2道手撕都不会...身心俱疲了.........
但还是尽量记录一下给uu们吧。
- hdfs edits log和fsimage分别记录什么?
- sql exist和in哪个快一些?
- Python class中__dict__是什么?
sql,求2024年交易次数至少10次的用户名、交易次数、交易总金额、交易类型,按照交易次数降序排序。
我死也记不清如何获得像id,customer_id,transaction_type的情况如何获得每个customer_id出现次数最多的transaction_type了。现在我要记录下来,都需要用到窗口函数,以下来自大模型。
法一:
WITH TransactionCount AS ( SELECT customer_id, transaction_type, COUNT(*) AS transaction_count FROM transaction_table GROUP BY customer_id, transaction_type ), RankedTransactions AS ( SELECT customer_id, transaction_type, transaction_count, ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY transaction_count DESC) AS rn FROM TransactionCount ) SELECT customer_id, transaction_type, transaction_count FROM RankedTransactions WHERE rn = 1;
法二:
SELECT customer_id, transaction_type, transaction_count FROM ( SELECT customer_id, transaction_type, COUNT(*) AS transaction_count, MAX(COUNT(*)) OVER (PARTITION BY customer_id) AS max_transaction_count FROM transaction_table GROUP BY customer_id, transaction_type ) AS subquery WHERE transaction_count = max_transaction_count;
算法题:翻转链表,要求用Python实现。要求前一半翻转,然后后一半也翻转。
例如[1,2,3,4,5]翻转为[2,1,5,4,3];[1,2,3,4]翻转为[2,1,4,3]。
#软件开发笔面经#